PDA

View Full Version : DIG DEC Madness



earltyso
- 13th June 2008, 22:36
All,
I have been right justifying my output to the screenso that I will always have my least sig fig in position 6 on line 1 of the 2x8 lcd....
My code works great EXCEPT for one little thing....if my value is..say 9, my output looks like..
[ 0,009 f], the first 0 is gone (as it should be) but the rest of the zeros and "," apear when they should not (don't want em!). I do not want to clear the screen everytime I take a new value as this will make the screen blink, just want a clear steady view. I have only included the code that applys to my dillema. Surely this is a silly error I am just not seeing right now...any help would be great.




lcdoutput:

VALUE = DIMP 'Y = ( DIMP *100 ) / 51 'divided down from * 255 / 130
VAL1 = VALUE DIG 0
VAL2 = VALUE DIG 1
VAL3 = VALUE DIG 2
VAL4 = VALUE DIG 3
VAL5 = VALUE DIG 4
LCDOUT 254,Row1+7,"f"

IF VALUE <= 9 THEN
LCDOUT 254,ROW1," ",DEC VAL1
endif

if value <= 99 then
lcdout 254,row1," ",DEC vAL2,DEC VAL1
ENDIF

if value <= 999 then
lcdout 254,row1," ",DEC VAL3,DEC VAL2,DEC VAL1
endif

if value <= 9999 then
lcdout 254,row1," ",DEC VAL4,",",DEC VAL3,DEC VAL2,DEC VAL1
endif

if value > 9999 then
lcdout 254,row1,DEC VAL5,DEC VAL4,",",DEC VAL3,DEC VAL2,DEC VAL1
endif


return

mister_e
- 13th June 2008, 23:05
Think about it, if it's <9... it's also <99 AND<999 and <9999 huh?