Shop OBEX P1 Docs P2 Docs Learn Events
4x20 Character LCD with BS2px only displays "////////..." — Parallax Forums

4x20 Character LCD with BS2px only displays "////////..."

LoLaLoLa Posts: 5
edited 2011-10-05 21:47 in General Discussion
I purchased a 4x20 character Parallax LCD and want to use it for a weather station later on. In trying to learn commands though, I have copied and pasted the couple of LCD sample programs that I have found online and can only get the display to show forward slashes. Depending on the program loaded it will write one to six at a time with pauses, but continues across the top line until it spills over to line two, then three and four, until the cursor loops around to the top and starts all over.

When I put the LCD in test mode it seems to work just fine. In any other mode it only displays the slashes, so other than changing the Stamp directive on the sample programs (I have a BS2px, and most samples are written with BS2), what do I need to check? I'm not going to try displaying the temperature until I can get the most simple "Hello World!" to display correctly.

Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-05 20:01
    Make sure that you're using the proper Baud constant for the Stamp model you're using. The values are different for the BS2 and the BS2px. The Stamp Editor help files have the values under the SEROUT statement section.
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-10-05 20:51
    The BS2px uses SEROUT 188 for 19,200 Baud, which is the fastest the Serial LCD will run. If it's like the one I have, both dip switches on the back have to be "on" for 19,200 Baud. See if this old test program I have will help you out. Change TxPin Con 8 to whatever pin you have your LCD connected to. I'm pretty sure this was for the 2x16 LCD, but I believe it will work on the 4x20 also.
  • LoLaLoLa Posts: 5
    edited 2011-10-05 21:02
    Thank you very much! Your program worked immediately. None of the other sample programs even list SEROUT 188 as an option. I will try editing the other sample programs for the animation scene, and then continue working on my weather station.
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-10-05 21:47
    Good to hear that it helped.

    In the Editor Help files, if you go to the "PBasic Language Reference" section, you will find a list of PBasic commands, click on SEROUT and it will take you to lots of info about that command.

    There is a section where it explains how to calculate that number (i.e 188) for any Baud mode and any type of Stamp. This is good to know because none of the tables that are shown go higher than 9600 Baud.

    You can also use "conditional compilation" by including this at the beginning of your program (requires PBasic 2.5)
    ' {$PBASIC 2.5}  
    
    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        T1200       CON     813
        T2400       CON     396
        T4800       CON     188
        T9600       CON     84
        T19K2       CON     32
        T38K4       CON     6
      #CASE BS2SX, BS2P
        T1200       CON     2063
        T2400       CON     1021
        T4800       CON     500
        T9600       CON     240
        T19K2       CON     110
        T38K4       CON     45
      #CASE BS2PX
        T1200       CON     3313
        T2400       CON     1646
        T4800       CON     813
        T9600       CON     396
        T19K2       CON     188
        T38K4       CON     84
    #ENDSELECT
    
Sign In or Register to comment.