Shop OBEX P1 Docs P2 Docs Learn Events
Parallax 4x16 LCD Help — Parallax Forums

Parallax 4x16 LCD Help

chris joneschris jones Posts: 391
edited 2011-05-21 08:39 in Propeller 1
Hello


i have a parallax 4x16 lcd and i have it working but i need to know how tosend text to the lcd. i currently have the Debug_LCD Driver but it seems to nothave the ability to send a fill string to the screen.

Comments

  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-20 07:38
    It would be nice if we knew some more details... Is the LCD serial or parallel interfaced? What microcontroller are you using(I assume a Stamp?). How are you powering your board? What software are you using? Are you missing external components?.. We will be shooting in the dark until we can get some specifics:)
  • chris joneschris jones Posts: 391
    edited 2011-05-20 07:41
    Hello

    Sorry for the lack of information, the project is developed on the propeller chip and i am using a propeller demo board.

    CODE BELOW
     
    {{
      RFID Tag Side (remote client)
    }}
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      XBEE_DOUT_PIN = 1
      XBEE_DIN_PIN  = 2
      XBEE_MODE     = %0000
      XBEE_BAUD     = 9_600
      LED_PIN       = 20
      
      LCD_PIN       = 3                                         ' for Parallax 4x20 serial LCD on P0
      LCD_BAUD      = 19_200
      LCD_LINES     = 4 
      
    obj
      xb    :       "FullDuplexSerial"  'comms to XBee.
      xbobj :       "XBee_Object_2"
      lcd   :       "debug_lcd"
      pst   :       "Parallax Serial Terminal"                   ' Serial communication object      
    var
      long  recv
      byte data[11]  
      
    pub go | idx
      xb.start(XBEE_DOUT_PIN, XBEE_DIN_PIN, XBEE_MODE, XBEE_BAUD) 'start comms to XBee
      pst.Startrxtx(1, 30, 0, 9600)' Notice pin 0 is the Rx pin on this end. Pin 30 is used for transmitting to the serial terminal
           
        if lcd.init(LCD_PIN, LCD_BAUD, LCD_LINES)             ' start lcd
          lcd.cursor(0)                                       ' cursor off
          lcd.backLight(true)                                 ' backlight on (if available)
          lcd.custom(0, @Bullet)                              ' create custom character 0
          lcd.cls                                             ' clear the lcd
          lcd.str(string("NODE", 13))
          lcd.putc(0)                                         ' display custom bullet character
          lcd.str(string("Recive", 13))
          lcd.putc(0)
          lcd.str(string("Transmit", 13)) 
          lcd.putc(0)
          'main loop
            repeat
              ReciveData
               
    
    pub ReciveData
        pst.strinmax(@data, 1)
        waitcnt(clkfreq/100 + cnt)
        updateLcd(@data) 
        pst.str(@data)
      
    pub Delay(mS)       ' Delay in milliseconds
     
       waitcnt(clkfreq / 1000 * mS + cnt)
    PRI updateLcd(value)
      lcd.gotoxy(12, 1)
      lcd.str(value)                                    ' print right-justified decimal value
      lcd.gotoxy(12, 2)
      lcd.str(value)                                 ' print indicated (with $) hex
    
    DAT
      Bullet      byte      $00, $04, $0E, $1F, $0E, $04, $00, $00     
     
    
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-20 07:51
    Mhhh. Did you mean 4x20? I didn't see any 4x16's on the Parallax website? The only 4x20 display that Parallax sells has a serial interface, so that takes care of that question. Serial displays are much easier to deal with... Could you upload your code? That would go a long way! Also, try messing around with the contrast pot and see if that helps at all...

    I was just typing this as you posted the datasheet:)
  • chris joneschris jones Posts: 391
    edited 2011-05-20 07:53
    sorry yes it is the 4x20 i was half asleep when i opened this post.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-20 08:00
    Most Parallax serial LCD's have a built in "splash screen" that will show up on the display by simply powering up the device and flipping the baud mode switches down to the default setting(test).. You should do that first to test to see if the module even works at all..
  • chris joneschris jones Posts: 391
    edited 2011-05-20 08:06
    It works , i have all of the code from my above post working but when i pass my variable to the update lcd function and back to the lcd i only get 1 character instead of my whole string. and i am using the string function.

    CODE SNIPPET
    PRI updateLcd(value)
      lcd.gotoxy(12, 1)
      lcd.str(value)                                    ' print right-justified decimal value
      lcd.gotoxy(12, 2)
      lcd.str(value)                                 ' print indicated (with $) he
    
    
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-20 08:10
    Gotcha:).... Strings/ arrays of data have to be passed with a "@" symbol or else it will not be recognized as a string of text.. So stick the @ right before the value. Like such
    Lcd.str(@Value)


    Or if you want to insert a string of text without a variable array, you could do this..

    Lcd.str(string("What hath God wrought?"))



    OR... Were you trying to display a decimal number as a value? If so, then you would need to change the line of code so that it will display a single byte/word/long of data as a ASCII string.. Like such

    Lcd.dec(value)
  • chris joneschris jones Posts: 391
    edited 2011-05-20 10:44
    When i put the @ in front of the variable it only send 1 character at a time i would like to send the whole string at once.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-20 10:58
    I think what you want is to send a decimal value to the LCD... ignore the first bit of what i said. Did you try the..

    lcd.dec(value)

    That should give you what you want... Yeah, i thought that you wanted to do was send a string of characters from an array to the LCD. You just want to display a byte of data as a ascii string. The above should work. Sorry for the confusion:)
  • chris joneschris jones Posts: 391
    edited 2011-05-20 17:40
    This sends a decimal value to the lcd i need to send a string so do i need to convert this string ?
  • max72max72 Posts: 1,155
    edited 2011-05-21 00:57
    Post the code, with the string handling portion.

    Consider a string is only a byte array, with the end of the sting identified by a 0. A "string" function returnd directly the address, and this is expected by the sting handling functions.
    If you have the string in a DAT section you should use the @, same if you create a string as an array.

    if you send

    lcd.str(string("hello"))

    does it work?

    Massimo
  • chris joneschris jones Posts: 391
    edited 2011-05-21 05:14
    Yes, it works thanks a bunch Massimo
  • max72max72 Posts: 1,155
    edited 2011-05-21 06:13
    If you need to format numbers as string check the objects in the propeller tool and in the obex.
    "numbers" and "simple numbers" are a good solution. Simple numbers is less powerful but easier to use, and sometimes even better.
    This way you have an already formatted string available.
    if num is you simple numbers object,

    lcd.str(num.dec(1234))

    will do all the job for you. If you need more complex formatting decf and decx are available.
    Massimo
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-21 08:36
    Perhaps i did not know what you were trying to accomplish and i only succeeded in making you more confused?
  • chris joneschris jones Posts: 391
    edited 2011-05-21 08:39
    no you helped alot by just replying. when i send numericalvalues over i know how to do it from your exmpale.

    Thanks
Sign In or Register to comment.