Decimal piont - serial LCD

Ed99

New Member
I'm reading in 10 bit value from an Xbee a/d, I've scaled the number and am outputing to a serial LCD. Is there any easy way of inserting a decimal piont with serout command?
Thanks for your help.
 
Current code is -
serout 6,T2400,(254,192,"Value=",#w0)
where w0 has a value between 0 & 1006
Looking fof this to be dislpayed as 100.6
Unsure how your code would work in my case.

Regards Ed
 
While we are on the LCD subject, how do I insert a variable into an LCD display?
Example display " Current Draw ** amps"
if b2 is the 12 and I want it inserted to read " Current Draw 12 amps".
This will allow me to read a current draw ant any time . Any ideas??

I'm using the david lincoln circuit for my LCD, not serial input into the LCD

Edited by - D n T on 25/12/2006 11:27:06
 
Try this

w0=1006

b2=w0/10
b3=w0//10
serout 6,T2400,(254,192,"Value=",#b2,".",#b3)


Edited by - Phil75 on 25/12/2006 11:39:18
 
And to answer DnT's question with almost the same code...
w0=1006

b2=w0/10
b3=w0//10
serout 6,T2400,(254,192," Current Draw is ",#b2,".",#b3," amps")

Or was that too obvious?
 
Although D n T did say he wasn't using a serial input to the LCD ;-)

I'm not seen David Lincoln's circuit or example code, but presume it's a typical parallel LCD connected directly to the PICAXE.

In that case it is necessary to split the number into individual digits and then send these one a time to the display, usually by calling whatever routine displays a single character ...

<code><pre><font size=2 face='Courier'>
bValue = 123 ' 12.3
'
bChar = bValue / 100 + &quot;0&quot; ' &quot;1&quot;
GOSUB DisplayChar '
bChar = bValue // 100 / 10 + &quot;0&quot; ' &quot;2&quot;
GOSUB DisplayChar '
bChar = &quot;.&quot; ' &quot;.&quot;
GOSUB DisplayChar '
bChar = bValue // 10 + &quot;0&quot; ' &quot;3&quot;
GOSUB DisplayChar ' </font></pre></code> And similar to that for word values.

Leading zero suppression or fixed field ( leading space padding ) requires more complex code using IF-THEN etc and can quickly use up a lot of code.
 
Im using option 3 on page 35 of the interface manual. I would like to know how to display a variable within a displayed message.
I will post the code tommorrow if it is easier to understand.
 
Dnt
This may help to give an idea ???, I have put the code Hippy posted above into a program that was published in the Silicon chip magazine for a parallel LCD (the code in the magazine was taken from Hippy's site by the way).
<code><pre><font size=2 face='Courier'>
#picaxe 18x

symbol RS = 2
symbol EN = 3
symbol bvalue = b10
symbol MEM = b11
symbol LCD_ch = b12
symbol RS_bit = b13

Start:
gosub init_lcd

Eeprom 0,(&quot;Current=&quot;)
Eeprom 8,(&quot;amps&quot;)

Display:
LCD_ch =$80
gosub wrcmd

for MEM = 0 to 7
read mem, lcd_ch
gosub wrchr
next

bValue = 123 ' 12.3
lcd_ch = bValue / 100 + &quot;0&quot; ' &quot;1&quot;
GOSUB wrchr
lcd_ch = bValue // 100 / 10 + &quot;0&quot; ' &quot;2&quot;
GOSUB wrchr
lcd_ch = &quot;.&quot; ' &quot;.&quot;
GOSUB wrchr
lcd_ch = bValue // 10 + &quot;0&quot; ' &quot;3&quot;
GOSUB wrchr

pause 250

lcd_ch=$c0
gosub wrcmd

for mem = 8 to 11
read mem,lcd_ch
gosub wrchr
next

pause 250
goto display

init_lcd:
pause 200
rs_bit=$00
pins=%00110000
pulsout en,1
pause 10
pulsout en,1
pause 1
pulsout en,1
pause 1
pins=%00100000
pulsout en,1
pause 1

lcd_ch=$28
gosub wrcmd
lcd_ch=$0c
gosub wrcmd
lcd_ch=$06
gosub wrcmd
lcd_ch=$01
gosub wrcmd
return
wrcmd:
rs_bit=$00
wrchr:
pins=lcd_ch &amp; %11110000 | rs_bit
pulsout en,1
pins=lcd_ch *16|rs_bit
pulsout en,1
rs_bit=%00000100
pause 5
return
</font></pre></code>
 
Back
Top