Help with PIcaxe LCD

Protoproff

New Member
HI all im dabbling with picaxe LCD 16 x 2 screen. can anyone help me to wrap my head round how to display/program things, mainly text on the screen, or point me to any relevant websites.
Thanks in Advance.
 

Protoproff

New Member
serout, pinout, baud, ("text")

Code:
serout C.0,N2400,(254,128)                       ' 128 first line
    serout C.0,N2400,(" test      ")
Hi again ive tried your test program, I had to add a pause 500 command, it works but has left part of the AXE133 firmware code after powering up. On boot up it says Serial LCD and on the second line it says www.picaxe.com.
after your test upload it now says: "test CD" on the first line, and "www.picaxe.com" on the second, any ideas?
 

Mark.R

Member
Have a search on YouTube for a chap called drbrono, he's done a little video valled " Using a Serial LCD with the Picaxe" I found it very informative to see code written in action.
 

Protoproff

New Member
new to posting ,

This is how far ive managed to get with the LCD with your help guys. I now have an LCD where i can display pot position 0-255, im trying to achieve an actual variable timing period from 0-30ms. Ive divided 255/30 giving 8.5 so i need to somehow work with this to enable me to control a single pulse width according to pot position. hope im making sense. Heres my bascic code so far, sorry its messy. I will look at the Youtube video recommend. Thanks

symbol res = c.1
pause 500 ;wait 0.5sec
serout C.4, N2400,(254,1) ;Clear the screen
pause 30 ;wait 30 required after clear screen
main: ;start of main program
readadc res,b0 ;read variable input (pot)
`debug
if b0 > 200 then gosub limit
serout C.4, N2400,(254,1) ;Clear the screen
pause 10
serout c.4, N2400, (254, 128, #b0, "ms")
pause 60

goto main

limit:
serout C.4, N2400,(254,1) ;Clear the screen
pause 30
serout C.4, N2400,(254,128) ;128 first line
serout c.4, N2400,("REACHEDLIMIT>200")
pause 1000

goto main
 

hippy

Technical Support
Staff member
im trying to achieve an actual variable timing period from 0-30ms. Ive divided 255/30 giving 8.5 so i need to somehow work with this to enable me to control a single pulse width according to pot position
You can use "PULSOUT <pin>, <N>" to generate a pulse where 'N' is in 10us units at 4MHz operating speed.

So for a pot reading of 0 to 255 you want N to be 0 to 3000, because 3000 x 10us = 30000us, 30ms.

In a perfect world -
Code:
ReadAdc <adcPin>, b0
w1 = b0 * 3000 / 255
PulsOut <pin>, w1
But, when b0 = 255, 3000 * 255 is greater than 65535 so that will overflow, be truncated, and won't work.

There are a number of solutions including -
Code:
ReadAdc <adcPin>, b0
w1 = b0 * 11
w1 = b0 ** 50114 + w1
PulsOut <pin>, w1
 

Protoproff

New Member
You can use "PULSOUT <pin>, <N>" to generate a pulse where 'N' is in 10us units at 4MHz operating speed.

So for a pot reading of 0 to 255 you want N to be 0 to 3000, because 3000 x 10us = 30000us, 30ms.

In a perfect world -
Code:
ReadAdc <adcPin>, b0
w1 = b0 * 3000 / 255
PulsOut <pin>, w1
But, when b0 = 255, 3000 * 255 is greater than 65535 so that will overflow, be truncated, and won't work.

There are a number of solutions including -
Code:
ReadAdc <adcPin>, b0
w1 = b0 * 11
w1 = b0 ** 50114 + w1
PulsOut <pin>, w1
wow im gonna try that now thx bud.
 
Top