Shop OBEX P1 Docs P2 Docs Learn Events
Prop to Parallax 27979 4x20 Serial LCD? — Parallax Forums

Prop to Parallax 27979 4x20 Serial LCD?

Kevin HortonKevin Horton Posts: 21
edited 2010-02-10 16:40 in Propeller 1
I'm a Prop newbie, trying to drive a Parallax 27979 4x20 Serial LCD with a Prop. The LCD works in test mode, but I haven't yet gotten it to display anything sent from the Prop. I'm wondering if maybe I've got an issue with the way I connected it to the Prop. I want to be sure I've got the hardware side correct so I don't start chasing my tail thinking it is a problem with the code.

I can't find any info on what the logic levels are on this display. Should I be able to directly connect a pin on the Prop to the RX pin on the LCD display? Or, is 3.3v from the Prop not enough to be sensed as a High on the display? If I need to correct the logic levels, can I do it with a pull up resistor, or do I need something like an SN7404N (I've got a few of these)?

Thanks,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Kevin Horton
Ottawa, Canada

Comments

  • hover1hover1 Posts: 1,929
    edited 2010-02-05 12:21
    Kevin,
    I'm pretty sure you can drive the LCD direct from the Prop (Prop to LCD RX).
    This posting may be of help:
    ·http://forums.parallax.com/showthread.php?p=869529

    Jim
  • AJMAJM Posts: 171
    edited 2010-02-05 13:58
    There is code for this LCD in the object exchange.

    Try out Jon Williams code. He always writes good stuff: Link

    I'm fairly certain that the serial RX pin can be driven by a prop pin.

    Post Edited (AJM) : 2/5/2010 2:06:28 PM GMT
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-02-05 14:08
    I don't suppose there's really any reason for it, but I have a Prop pin going out to the LCD through a 1K resistor. I've always done it that way, and it works fine. I've got one sitting right here that I was working with yesterday, a Parallax 4x20 LCD attached to a Prop Professional Development Board. I've done it that way with a Protoboard as well, with the same LCD.

    Make certain that you have a 5V power supply to the LCD. While the serial input may work at 3.3V, I don't think that you can power the LCD with just 3.3V.·(though I guess the test mode wouldn't work if your power supply·were inadequate, so you must be okay already on that front).

    I'm using the Debug_LCD object, with code that looks like this (I just tested it: it works just fine in this form):

    CON 
        _clkmode = xtal1 + pll16x      '80MHz operating frequency.
        _xinfreq = 5_000_000                      
        Hz    = 100
    
     
    OBJ 
      LCD  : "Debug_LCD"
    
         
    Pub Start 
        LCD.init(0, 9600, 4)           ' Initialize LCD - here the LCD is attached through a 1K resistor to pin 0. Change the "0" to the pin you're using. 
        Pause(1500)                    ' Let the LCD settle in
        LCD.cls                        ' Clear the screen
        Splash                         ' Show startup screens
        LCD.cls
        Screenlabels                   ' Label the values
     
    Pub Splash                         ' Display startup screen
      LCD.home
      LCD.backlight(TRUE)
      LCD.gotoxy(0,0)
      LCD.str(@Splash1)
      LCD.gotoxy(0,1)
      LCD.str(@Splash2)
      LCD.gotoxy(0,2)
      LCD.str(@Splash3)
      LCD.gotoxy(0,3)
      LCD.str(@Splash4)
      Pause(1000)
    '  LCD.backlight(FALSE)    ' Uncomment to turn off backlight after Splash
      Pause(3000)
    
    Pub Screenlabels
      LCD.gotoxy(0,0)
      LCD.str(String("Timer       : "))
      LCD.gotoxy(0,1)
      LCD.str(String("Temperature : "))
      LCD.gotoxy(0,2)
      LCD.str(String("Humidity    : "))
      LCD.gotoxy(0,3)
      LCD.str(String("Pressure    : "))
     
    PUB Pause(mS)
      waitcnt(clkFreq/1000 * ms + cnt)
     
    DAT
      Splash1 byte "Environmental Sensor",0
      Splash2 byte "Version 1.0         ",0
      Splash3 byte "Paul C. Smith       ",0
      Splash4 byte "Feb 4, 2010         ",0
    

    You can see in this code two different ways to send strings of text to the LCD, either by declaring them in the DAT section (with a terminating "0") and then passing a pointer (the "@" sign "points" to the data through its address) to LCD.str, or using the "String" function to convert quoted text to a zero-terminated string that LCD.str can work with.

    One thing that has stymied me a few times working with a Prop and an LCD is how fast things happen. My text was appearing, but disappearing again before I saw it. Try putting a pause in after your attempt to display something.

    Post Edited (sylvie369) : 2/5/2010 2:43:47 PM GMT
  • Kevin HortonKevin Horton Posts: 21
    edited 2010-02-05 21:22
    sylvie369 said...
    I'm using the Debug_LCD object, with code that looks like this (I just tested it: it works just fine in this form):
    Sylvie369 - Thank you very much for the code. It works perfectly, so now I know my hardware configuration is OK. My code still doesn't work, but I'll study your example and come back with questions if needed.

    AJM said...
    here is code for this LCD in the object exchange.

    Try out Jon Williams code. He always writes good stuff:
    AJM - I was trying to use Jon's object, but unfortunately it does not include any example code, and I obviously made a few bad guesses, or perhaps stupid mistakes, because my code did nothing useful.

    ARGGH - I just found the error in my original code. It was a stupid, stupid typo in a waitcnt statement after I initialized the LCD. Word to the wise - if you want to wait 5 ms, you want waitcnt(clkfreq / 200 + cnt), not waitcnt(clkfreq * 200 + cnt). smhair.gif My original code worked, but I never waited 200 seconds before deciding it was broke. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Kevin Horton
    Ottawa, Canada

    Post Edited (Kevin Horton) : 2/5/2010 11:59:47 PM GMT
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-02-05 23:15
    LOL. That's a fun mistake to have made. I'm glad it was something that simple. So much for my suggestion that you add a "Pause", hey? tongue.gif

    It feels good to realize that you did know what you were doing after all, doesn't it?

    I've made that kind of mistake quite a few times, usually with a wire plugged into the wrong hole on a protoboard (discovered after 2 hours of messing with code).

    Post Edited (sylvie369) : 2/5/2010 11:25:34 PM GMT
  • mugurmugur Posts: 105
    edited 2010-02-06 11:38
    I ask here because i don't think it deserves a new thread.But i appologise if i was wrong.
    Can anyone have a look at this LCD and tell me that it will work on the propeller? (full circuit diagram there also)

    www.sure-electronics.net/download/DE-LD013_Ver1.0_EN.pdf

    Thank you!

    Post Edited (mugur) : 2/6/2010 12:08:23 PM GMT
  • navila17navila17 Posts: 12
    edited 2010-02-08 18:31
    I have been trying to get this exact LCD to work on my Propeller Demo Board for a couple of days now. So far all I can get is the test screen with both switches in off position. I just tried your code up there, although I do not have an external crystal so I edited it to work on the internal clock. But I cannot get a single thing to display, or even turn the back light on for that matter. Is it possible that I still have the hardware plugged in wrong even though the test screen works? Also I have tried several different rx pins and still get nothing.

    Thanks,
    Nick
  • hover1hover1 Posts: 1,929
    edited 2010-02-08 18:57
    Nick,

    You need to use a crystal because the timing on serial data is dependent on a fixed frequency. The internal clock is not exact and drifts over time.·Using the software you cited, set the switches to 9600 baud, (SW1-OFF, SW2-ON).

    Jim
    navila17 said...
    I have been trying to get this exact LCD to work on my Propeller Demo Board for a couple of days now. So far all I can get is the test screen with both switches in off position. I just tried your code up there, although I do not have an external crystal so I edited it to work on the internal clock. But I cannot get a single thing to display, or even turn the back light on for that matter. Is it possible that I still have the hardware plugged in wrong even though the test screen works? Also I have tried several different rx pins and still get nothing.

    Thanks,
    Nick
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-02-08 22:23
    When I first tried to use an LCD with a Prop I had the timing wrong, and it simply didn't work. I don't remember where I went to for the correct way to do it, but I've done it like this - with a crystal - ever since, with no trouble at all.
  • hover1hover1 Posts: 1,929
    edited 2010-02-08 23:21
    Nick,
    When you get a crystal (5Mhz) installed, run the code here:
    http://obex.parallax.com/objects/40/
    It is set up for 19,200 baud so you will need to set both switches to ON on the back of the LCD. I have it running now on my Propeller.
    Jim
    navila17 said...
    I have been trying to get this exact LCD to work on my Propeller Demo Board for a couple of days now. So far all I can get is the test screen with both switches in off position. I just tried your code up there, although I do not have an external crystal so I edited it to work on the internal clock. But I cannot get a single thing to display, or even turn the back light on for that matter. Is it possible that I still have the hardware plugged in wrong even though the test screen works? Also I have tried several different rx pins and still get nothing.

    Thanks,
    Nick
  • hover1hover1 Posts: 1,929
    edited 2010-02-08 23:32
    I would think it would be a new thread based on the USB interface. Are you wanting to control individual characters, or the modules that are on the web site?
    mugur said...
    I ask here because i don't think it deserves a new thread.But i appologise if i was wrong.
    Can anyone have a look at this LCD and tell me that it will work on the propeller? (full circuit diagram there also)

    www.sure-electronics.net/download/DE-LD013_Ver1.0_EN.pdf

    Thank you!
  • Kevin HortonKevin Horton Posts: 21
    edited 2010-02-09 00:19
    hover1 said...
    Nick,

    You need to use a crystal because the timing on serial data is dependent on a fixed frequency. The internal clock is not exact and drifts over time. Using the software you cited, set the switches to 9600 baud, (SW1-OFF, SW2-ON).
    Also, my testing shows that if you use an LCD object that uses the Simple_Serial object for comms with the LCD, you need to set the clock at a fairly high multiplier if you want to communicate at 9600 or 19200 baud. If the multiplier is set too low, the code apparently doesn't run fast enough to spit out the bits at the required rate, and the communication quietly fails. For 19200 baud, I found that I needed to set the _clkmode to xtal1 + pll16x. Even at 2400 baud, you need xtal1 + pll2x (assuming a 5 Mhz external crystal).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Kevin Horton
    Ottawa, Canada
  • mugurmugur Posts: 105
    edited 2010-02-10 16:40
    Not at all, just trying to find a cheaper serial LCD, i thought "ok, it is usb, but before that, it is still an UART"

    hover1 said...
    I would think it would be a new thread based on the USB interface. Are you wanting to control individual characters, or the modules that are on the web site?

    mugur said...

    I ask here because i don't think it deserves a new thread.But i appologise if i was wrong.
    Can anyone have a look at this LCD and tell me that it will work on the propeller? (full circuit diagram there also)

    www.sure-electronics.net/download/DE-LD013_Ver1.0_EN.pdf

    Thank you!
Sign In or Register to comment.