Shop OBEX P1 Docs P2 Docs Learn Events
Serial LCD with SX28 — Parallax Forums

Serial LCD with SX28

crgwbrcrgwbr Posts: 614
edited 2006-10-09 17:43 in General Discussion
Hey Everyone,
I'm using the LK202-25 LCD with Keypad interface that Parallax sells.· I can send it a single letter just fine, I can also send it a string to display, but I have to do it one letter or number at a time, which is a big pain.· If I send the string all at one (as in serout TX, baud, "string"), I only see the first letter of the string.· Why is this so?· Is there anyway around this?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-09 16:06
    Hello,
    ·
    ·· If you could post (attach) the code you’re using that might help us to help you.· Also, are you using a resonator or crystal for your clock or the internal osc?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • crgwbrcrgwbr Posts: 614
    edited 2006-10-09 16:17
    Here is the code.· I am using an external 50 Mhz ceramic resonater.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • SailerManSailerMan Posts: 337
    edited 2006-10-09 16:21
    I am fairly sure that the Serout command can only handle one byte at a time. I probably shouldn't be commenting because I am having a Serial Nightmare on another thread.

    Eric
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2006-10-09 17:16
    crgwbr,

    SailorMan is right. The serout command transmits one serial byte at a time. To send several characters one after the other you will need to loop and update the character to be sent until all have been transmitted. This is not hard. In fact, there is a good example of how to do this in the SX/B help files. Click on the serout command. Scroll to the bottom of the page to where is says "Related projects:." Click on the RFID Reader Interface link and look at the serial subroutines in contains. Of particular interest to what you are trying to do is the LCD_OUT: subroutine. I have copied it here for you below but you may wish to examine the entire sample program to figure out how it works.

    ' -------------------------------------------------------------------------
    ' Use: LCD_OUT [noparse][[/noparse] aByte | string | label ]
    ' -- "aByte" is single-byte constant or variable
    ' -- "string" is an embedded literal string
    ' -- "label" is DATA statement label for stored z-String
    
    LCD_OUT:
      tmpB1 = __PARAM1                              ' byte or string offset
      IF __PARAMCNT = 2 THEN                        ' string specified?
        tmpB2 = __PARAM2                            '   yes, save base
        DO
          READ tmpB2 + tmpB1, tmpB3                 ' read a character
          IF tmpB3 = 0 THEN EXIT                    ' if 0, string complete
          SEROUT LcdTx, LcdBaud, tmpB3              ' send the byte
          INC tmpB1                                 ' point to next character
          tmpB2 = tmpB2 + Z                         ' update base on overflow
        LOOP
      ELSE
        SEROUT LcdTx, LcdBaud, tmpB1                ' send the byte
      ENDIF
      RETURN
    ' -------------------------------------------------------------------------
    
    



    LCD_OUT gets called as shown below which sends the entire string to the LCD.

    LCD_OUT "Present ID."
    
    



    I hope this helps!

    - Sparks
  • crgwbrcrgwbr Posts: 614
    edited 2006-10-09 17:43
    Thanks, That did Help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life

    Post Edited (crgwbr) : 10/9/2006 6:49:19 PM GMT
Sign In or Register to comment.