Shop OBEX P1 Docs P2 Docs Learn Events
Propeller writing to SparkFun Serial LCD — Parallax Forums

Propeller writing to SparkFun Serial LCD

StevenGStevenG Posts: 9
edited 2010-07-03 16:23 in Propeller 1
I have the Propeller Servo Controller USB and a SparkFun Serial LCD. I was wondering if anyone has some example code for writing text/commands to the LCD. I've played around with it a little but got frustrated. Any help would be much appreciated.

Propeller Servo Controller USB
http://www.parallax.com/Store/Microcontrollers/PropellerDevelopmentBoards/tabid/514/CategoryID/73/List/0/SortField/0/Level/a/ProductID/595/Default.aspx

SparkFun Serial LCD
http://www.sparkfun.com/commerce/product_info.php?products_id=9395 mad.gif

Comments

  • StevenGStevenG Posts: 9
    edited 2010-07-02 18:03
    Ok. I've written a small program to write ASCII characters to the LCD but I can't seem to get any of the LCD commands to work. They almost always come up as two vertical lines in one character space. I have attached the code I am using.

    The code should turn on the Blinking Box Cursor and then write "Hello World!" to the LCD. Instead it prints "||Hello World!".

    humm.........

    CON
    
      baud            = 9600                                          ' baud rate
      pin             = 0                                             ' tx pin
      _clkmode        = xtal1 + pll16x
      _xinfreq        = 5_000_000
    
      
      LCD_BKSPC     = $10                                   ' move cursor left
      LCD_RT        = $14                                   ' move cursor right
      LCD_CLS       = $01                                   ' clear LCD (follow with 5 ms delay)
      LCD_SET       = $7C                                   ' LCD Set Parameter
        LCD_BL1     = 128                                   ' Set backlight to 0%
        LCD_BL2     = 140                                   ' Set backlight to 40%
        LCD_BL3     = 150                                   ' Set backlight to 73%
        LCD_BL4     = 157                                   ' Set backlight to 100%
    
        LCD_SST     = $09                                   ' Toggle Splash Screen
        LCD_SSS     = $0A                                   ' Save current screen to splash screen
    
        LCD_24      = $4B                                   ' Set Baud to 2400
        LCD_48      = $4C                                   ' Set Baud to 4800                        
        LCD_96      = $4D                                   ' Set Baud to 9600
        LCD_144     = $4E                                   ' Set Baud to 14400
        LCD_192     = $4F                                   ' Set Baud to 19200
        LCD_384     = $50                                   ' Set Baud to 38400
        
      LCD_OFF       = $08                                   ' LCD visual off
      LCD_ON        = $0C                                   ' LCD visual on
      LCD_CRON      = $0E                                   ' LCD cursor on
      LCD_CROFF     = $0C                                   ' LCD cursor off
      LCD_BXON      = $0D                                   ' Blinking box cursor on
      LCD_SR        = $1C                                   ' LCD scroll right
      LCD_SL        = $08                                   ' LCD scroll left
      LCD_CRP       = $80                                   ' LCD set cursor position + position 
      
    OBJ
    
      serial : "simple_serial"                              ' bit-bang serial driver
    
    PUB init | Temp
    
      waitcnt(clkfreq / 4_000 + cnt)  
      serial.init(-1, pin, baud)
      waitcnt(clkfreq / 200 + cnt)
      serial.tx(LCD_BXON)
      waitcnt(clkfreq / 200_000 + cnt)
      serial.str(string("Hello World!"))                              
    
    
  • HarleyHarley Posts: 997
    edited 2010-07-02 18:09
    One thing I note is there is no 'repeat'. Your code just runs to the last instruction ONCE.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • grouchygrouchy Posts: 16
    edited 2010-07-03 01:46
    try this, what I use for my sparkfun serial lcd.

    note that if your using the 3.3v lcd, it sometimes gets confused at power up if the usb plug is connected (on the demo board). To reset the lcd, remove the usb plug as well as power down the demo board.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Rudy's CNC Freeware·· http://www.enter.net/~schleinkofer
  • mparkmpark Posts: 1,305
    edited 2010-07-03 15:35
    Grouchy, cute use of lookdown!

    StevenG, you have to send $fe before sending a command byte.
  • StevenGStevenG Posts: 9
    edited 2010-07-03 16:23
    Ya I forgot about the whole command byte thing. The $FE common byte doesn't work for the backlight and some other commands. You have to send the $7C command for those. It takes a little trial and error to figure out which one requires what. Thanks a lot Grouchy that helped a ton!!!
Sign In or Register to comment.