Name:
bcdtoascii
Syntax:

BCDTOASCII variable, tens, units

BCDTOASCII wordvariable, thousands, hundreds, tens, units

Variable - contains the value (0-99) or wordvariable (0-9999)

Thousands - receives the ASCII value ("0" to "9")

Hundreds - receives the ASCII value ("0" to "9")

Tens - receives the ASCII value ("0" to "9")

Units - receives the ASCII value ("0" to "9")

Description:

Convert a BCD value into separate ASCII bytes. This is a 'pseudo' command designed to simplify the conversion of byte or word BCD values into ASCII. Note that the maximum valid value for a BCD value is 99 (byte) or 9999 (word).

Applies To:
All
See Also:
Related Create:
    Share:
    Print:

    Convert bcd byte to ascii characters

    Convert the bcd byte value in b1 to two ascii characters in b2 and b3

    Code Example:
    main:	inc b1
    	bcdtoascii b1,b2,b3	; convert to ascii
    	debug			; debug values for testing
    	goto main		; loop back to start
    Copy Code Submit an Example

    Convert bcd word to ascii characters

    Convert the bcd word value in w0 to four ascii characters in b2, b3, b4 and b5

    Code Example:
    main:	inc w0
    	bcdtoascii w0,b2,b3,b4,b5	; convert to ascii
    	debug				; debug values for testing
    	goto main			; loop back to start
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.