LCDOUT -- lose the zero ?
Can't figure out how to do this --
mynumber = byte
mynumber = 120
LCDOUT $FE,1,DEC mynumber
also tried --
LCDOUT $FE,1,#mynumber
Problem is that whenever I lower the number below 100 (I have 2 switches set up - and +), the LCD
will read 990 980 etc instead of 99, 98.
It's fine from 100 to 255.
Also, if I start mynumber with a value of say 90, if I remember right, it's ok UNTIL I move it past 100. Then when I try and lower it, it goes back to adding the zero 990, 980 etc.
I don't use pbp much anymore so I'm sure it's something simple. Thanks kindly for any help.
Re: LCDOUT -- lose the zero ?
Try this LCDOUT $FE,1,#mynumber," "
$FE,1 should clear display. But for some reason your display isn't cleared.
Re: LCDOUT -- lose the zero ?
I use the following code to display a word variable which contains the value between 0 and 100
Code:
If maxbright = 100 then
LCDOut $FE,$c0,#maxbright,"%"
endif
If maxbright =0 or maxbright <10 then
LCDOut $FE,$c0,dec1 maxbright,"% "
endif
if maxbright >=10 and maxbright <100 then
LCDOut $FE,$c0,dec2 maxbright,"% "
endif
Just change maxbright for your variable and you should be fine
Re: LCDOUT -- lose the zero ?
I don't have problem with leading zeros, so I just use DEC3 to make it simple.
Re: LCDOUT -- lose the zero ?
I resorted to a longer method of writing to an LCD. To get numeric values to print, first I create variables for each digit.
Code:
Val VAR BYTE
ValA VAR BYTE[3] 'Occupies 3 consecutive addresses
ARRAYWRITE ValA, [#Val]
IF Val < 100 then
ValA[2] = ValA[1]
ValA[1] = ValA[0]
ValA[0] = " "
I then print individual characters to the LCD.
Re: LCDOUT -- lose the zero ?
Ok. I get it now. Never really used LCDOUT or an LCD for that matter. Wasn't clearing the display, thinking I could just manipulate line 2 leaving line 1 intact. Silly me. --- thanks