Formating Question
I am attempting to convert the decimal format of a variable into two separate hex digits...· please see example below...
Dest····· VAR···· Byte
Dest = 24 (18 as a hex, or $18)
Now I need to look at the hex as if it was a character and convert those characters to two hex digits....
1 as a character = 31 as a hex, and 8 as a character = 38 as a hex...
Now I want to debug the data as:· ·31 38
Eventually I want to output that data as part of a serial string...
I just can't seem to figure out the character part of the formatting...· Thanks in advance for any help....
Dest····· VAR···· Byte
Dest = 24 (18 as a hex, or $18)
Now I need to look at the hex as if it was a character and convert those characters to two hex digits....
1 as a character = 31 as a hex, and 8 as a character = 38 as a hex...
Now I want to debug the data as:· ·31 38
Eventually I want to output that data as part of a serial string...
I just can't seem to figure out the character part of the formatting...· Thanks in advance for any help....
Comments
If Dest.HighNib>9 Then
Factor=55
Else
Factor=48
Endif
Byte_1 = Dest.HighNib+Factor
If Dest.LowNib>9 Then
Factor=55
Else
Factor=48
Endif
Byte_2=Dest.LowNib+Factor
DEBUG Hex2 Byte_1," ",Hex2 Byte_2
Jeff T.