Not going to do it. xmit_rs232 is only going to transmit one byte at a time. Check out Hugh's LCD Hex() sub in the include/lowlevel/lcd.h file. Just substitute xmit_rs232() to write the byte for each hex nibble:
Main:
xmit_rs232(0x0D) ;carriage return
xmit_rs232(0x0A) ;line feed
SerialHex(0x9F) ;dec 159
xmit_rs232(0x0D) ;carriage return
xmit_rs232(0x0A) ;line feed
wait 1 s
for testhex = 1 to 15
if testhex <= 9 then bin2ascii testhex
if testhex = 10 then Xmit_Print "A"
if testhex = 11 then Xmit_Print "B"
if testhex = 12 then Xmit_Print "C"
if testhex = 13 then Xmit_Print "D"
if testhex = 14 then Xmit_Print "E"
if testhex = 15 then Xmit_Print "F"
wait 1 s
next
goto Main
sub SerialHex(In Value)
ValueTemp = 0
IF Value >= 0x10 then
ValueTemp = Value / 0x10
Value = Value % 0x10
if ValueTemp > 9 then ValueTemp = ValueTemp + 7
xmit_rs232 (ValueTemp + 48) ;upper nibble
end if
ValueTemp = Value
if ValueTemp > 9 then ValueTemp = ValueTemp + 7
xmit_rs232 (ValueTemp + 48) ;lower nibble
end sub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Say I have:
A = "F"
B = "8"
dim variableA as byte
dim variableB as byte
dim combinedAB as word
combinedAB = B
combinedAB_H = A
xmit_rs232 (h'combinedAB')
but I am sure that the last part is not correct, I need "F8" output in hex
Not going to do it. xmit_rs232 is only going to transmit one byte at a time. Check out Hugh's LCD Hex() sub in the include/lowlevel/lcd.h file. Just substitute xmit_rs232() to write the byte for each hex nibble:
Main:
xmit_rs232(0x0D) ;carriage return
xmit_rs232(0x0A) ;line feed
SerialHex(0x9F) ;dec 159
xmit_rs232(0x0D) ;carriage return
xmit_rs232(0x0A) ;line feed
wait 1 s
for testhex = 1 to 15
if testhex <= 9 then bin2ascii testhex
if testhex = 10 then Xmit_Print "A"
if testhex = 11 then Xmit_Print "B"
if testhex = 12 then Xmit_Print "C"
if testhex = 13 then Xmit_Print "D"
if testhex = 14 then Xmit_Print "E"
if testhex = 15 then Xmit_Print "F"
wait 1 s
next
goto Main
sub SerialHex(In Value)
ValueTemp = 0
IF Value >= 0x10 then
ValueTemp = Value / 0x10
Value = Value % 0x10
if ValueTemp > 9 then ValueTemp = ValueTemp + 7
xmit_rs232 (ValueTemp + 48) ;upper nibble
end if
ValueTemp = Value
if ValueTemp > 9 then ValueTemp = ValueTemp + 7
xmit_rs232 (ValueTemp + 48) ;lower nibble
end sub