Displaying Hex with BenkyLCDdriver
Hello,
I am playing with the excellent BenkyLCDdriver, and am trying to figure out how to use it to display hex values for variables. It has a simple enough to use printDec method in its demo for displaying decimal values:
I see there is also a method for doing something with hex:
But that doesn't print the hex values to the display. I tried to adapt it, but I'm feeling a bit lost in the weeds. Any suggestions would be greatly appreciated.
I am playing with the excellent BenkyLCDdriver, and am trying to figure out how to use it to display hex values for variables. It has a simple enough to use printDec method in its demo for displaying decimal values:
PUB printDec( val ) | i
i:=10
if val>0
repeat while val<>0
i--
num[i]:="0"+val//10
val:=val/10
else
LCD.exec( LCD#CMD_WRITE, "0" )
LCD.exec( LCD#CMD_PRINT, @num+i )
dat
num byte 0[11]
I see there is also a method for doing something with hex:
PUB hex(value, digits) | blubb
value <<= (8 - digits) << 2
repeat blubb from 0 to digits-1
byte[@text3+blubb]:=lookupz((value <-= 4) & $F : "0".."9", "A".."F")
But that doesn't print the hex values to the display. I tried to adapt it, but I'm feeling a bit lost in the weeds. Any suggestions would be greatly appreciated.

Comments
' this part prints the hexadecimal number repeat 100 waitcnt(cnt+clkfreq/20) LCD.exec( LCD#CMD_INSTR, ( 000000 + $55 ) ) LCD.exec( LCD#CMD_PRINT, @text3 ) hex( counter++, 8 )