Shop OBEX P1 Docs P2 Docs Learn Events
Lcd problem — Parallax Forums

Lcd problem

grkblood13grkblood13 Posts: 31
edited 2007-03-09 01:15 in Learn with BlocklyProp
ok, this is one section of a much larger code. but for my purpose of showing you what i'm doing this is all thats needed. all that i want to do is display "total", all my LCD is doing though is displaying a "\". please help, what am i doing wrong???·also, im using P15 to communicate with the LCD.

' {$STAMP BS2p}
' {$PBASIC 2.5}
location CON 0
i VAR Nib
total VAR Word

DO
PAUSE 1000······················ 'delay to compensate for time to get on scale'
total = 0
FOR i = 1 TO 15
total = total + (INS & $01FF)
PAUSE 100························ 'this delay is because the converter is running at 10 Hz'
NEXT
total = total / 15
WRITE location,total
DEBUG DEC total
SEROUT OUT15,16468,[noparse][[/noparse]DEC total]
LOOP

Comments

  • edited 2007-03-07 19:13
    Well, one problem is that you are using out15 as the SEROUT command's Pin argument. This register will either store a 1 or a 0. If your LCD is connected to P15, use SEROUT 15,...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • grkblood13grkblood13 Posts: 31
    edited 2007-03-07 19:20
    i did that and it displayed a "b" and then a couple seconds later it displayed a "$"
    , but total is usually around 510, so i dont understand why it wont display the value 510
  • Paul Sr.Paul Sr. Posts: 435
    edited 2007-03-07 19:59
    grkblood13 said...
    i did that and it displayed a "b" and then a couple seconds later it displayed a "$"
    , but total is usually around 510, so i dont understand why it wont display the value 510

    Could it be the wrong BAUD rate? Have you tried other values like 240 in place of the 16468?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-07 20:34
    Hello,

    It would help to know the Make/Model of the LCD. The baud parameter you used is for inverted baud mode. Are you sure the LCD uses inverted mode? Are there jumpers to set the baud rate on the display? Do they match the speed (9600 bps) you chose? Your Stamp Directive indicates a BS2p and the baud rate value for 9600 bps inverted on that is 16624. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-03-07 20:34
    I know it's not obvious from the documentation, but the "baudmode" constant that gets you 9600 baud is different for the BS2 than the BS2p.

    Thus, 16468 will get you "Inverted", 9600 baud on a BS2, BS2e, and BS2pe

    BS2sx and BS2p need 16624 to get "Inverted", 9600 baud (or 240 for non-inverted, 9600 baud).

    So, you're probably using the wrong "baudmode" value to get the baud rate you want. This is documented under the SEROUT keyword in the PBasic 'help' file.
  • grkblood13grkblood13 Posts: 31
    edited 2007-03-08 23:38
    thanks, that was the problem. i have two different LCD screens, one is 2X32, and the other 4X40. i got the smaller one to work but not the bigger one. i tried all the different baudrates just to make sure i wasnt messing that up again. i prolly fried it or something. i have one more question though, is there an easy way to clear the LCD screen? i know how to clear the debug screen but not when its on the LCD. i tried stuff like....

    serout 15,240,[noparse][[/noparse]CLS]

    but apparently its not that easy.
  • RDL2004RDL2004 Posts: 2,554
    edited 2007-03-09 01:15
    What is the make and model of the LCD? If these are serial LCDs they all have specific commands for things like clearing the screen and positioning the cursor, and such, but they do not all use the same commands. The commands differ from one manufacturer to another.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Rick
Sign In or Register to comment.