Shop OBEX P1 Docs P2 Docs Learn Events
Using the 4x20 Serial LCD — Parallax Forums

Using the 4x20 Serial LCD

FonziFonzi Posts: 17
edited 2008-04-07 05:55 in Propeller 1
Hey everyone,

I just purchased the 4x20 Serial Backlight LCD display Parallax sells (product can be found here: http://www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/Level/a/ProductID/51/Default.aspx?SortField=ProductName%2cProductName)

I'm using the Serial_Lcd object as the driver (available through the Object Exchange) and the P8X32A-D40 chip. Unfortunately, for some reason, I cannot get it to work. It works fine with the "Test" setting (selectable through the baud rate switch settings on the back of the unit), but when I try to send it text, nothing comes up. The documentation for it mentions the Basic Stamp 2, so I'm not sure if it is even capable of working with the P8X32A-D40 (although I don't see any reason it wouldn't). If any of you have had success using it with this chip, or know if it should be capable of working with this chip, please let me know. Also, does the LCD expect TTL or serial voltage levels?

Thanks.

·

Comments

  • AleAle Posts: 2,363
    edited 2008-04-03 09:58
    I heard that some people have trouble with 5V displays and the propeller (like me !), so a level shifter may be necessary. If the display expects a TTL signal, the propeller should be able to provide those voltages. In any case a simple HCT gate (And, buffer, OR) powered from 5V and with a 1k series resistor to the propeller should be all you need.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-04-03 16:25
    Hello,

    The display should work just fine with the Propeller. Are you sure your baud rate and mode information on the Propeller match the settings on the display? Are you using the Full Duplex Serial object?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • FonziFonzi Posts: 17
    edited 2008-04-03 17:01
    I'm using the Serial_Lcd.spin object as a driver for the communication, which uses the simple_serial object. I tried modifying it to use the Extended_FDSerial object, but still no luck. But does the display expect TTL or serial voltage levels? I ask this because we have used a TTL to serial converter chip with the chip before for other uses, I'm wondering if we would need that in this case (although we have reasonably tried it out both ways already).
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-04-03 17:12
    Fonzi,

    What do you mean by TTL to serial? TTL refers to the signal level whereas serial refers to the protocol. Now if you’re using a line driver for RS-232 levels, such as a MAX232 you may very well have damaged the display. The Serial LCD uses TTL level serial. Not RS-232 level serial.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • FonziFonzi Posts: 17
    edited 2008-04-04 17:49
    Hello Chris,

    Yes, I meant a line driver for RS-232 voltage levels. So I guess that's not the route to go (seems like the display is still functioning properly).

    So, from my understanding, the Propeller chip outputs on its own 3V; however the LCD requires 5V. Is this the reason it was suggested to include the 1k resistor at the chip's output? Some sort of circuitry modification would be necessary, correct? Connecting the output pin of the Propeller chip to the LCD monitor directly wouldn't work, right?
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-04-04 23:32
    hello fonzi,

    Yes. Direct connecting does not work.

    For the direction Propeller-Output ---> LCD-Input you need a levelshifter

    For the direction LCD-Output ----> Propeller-Input it is enough to have a current-limiting resistor of 1kOhm

    a resistor in Propeller-Output ---> LCD-Input would make the problem bigger
    because of the voltagedrop across the resistor

    For this direction you REALLY need a levelshifter that creates 5V for the LCDisplay

    This could be a transistor or a digitical buffer which has the specification 5V and logical high
    is detected by voltages equal / above 2.5V


    best regards

    Stefan
  • tpw_mantpw_man Posts: 276
    edited 2008-04-05 14:48
    I have used a direct connect LCD of the same kind (4x20 backlit) without any problems at all. Just going pin ---> lcd rx works fine for me. I have been using the Debug_Lcd object instead of the Serial_Lcd object. I don't think it will make a difference because the Debug_Lcd object uses the Serial_Lcd object as its core.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1010, so be surprised!

    Post Edited (tpw_man) : 4/5/2008 2:56:11 PM GMT
  • FonziFonzi Posts: 17
    edited 2008-04-06 23:30
    So I got the LCD to work...somewhat. The putc and str functions work fine, however any command that specifies a change in position (either the cls, home·or gotoxy methods) does not work. This is particularly frustrating, as the display isn't that large and I want to maximize the use of the display area. Also, in the Serial_LCD datasheet, it specifies to wait 100 miliseconds after initializing the·Serial_Lcd object. This does not work, and it seems that any sort of waitcnt method placed anywhere messes things up. Here is the code:

    CON
    ·_clkmode = xtal1
    ·_xinfreq = 5_000_000
    OBJ
    · LCD: "Serial_Lcd"
    PUB start
    · LCD.start(16, 19200, 4)
    ··'waitcnt(100)·· DOES NOT WORK
    · LCD.str(String("······························································································ "))
    · LCD.gotoxy(0, 0)

    This was my idea for achieving the same result as the clear screen method, but alas, the gotoxy function accomplishes nothing and the cursor is left pointing somewhere random after the long string of spaces. Since it's the weekend, I've unfortunately not been able to correct the voltage problem; I'd have to wait until tomorrow. But would that really change anything, considering text is displayed, just certain functionality isn't working? Any help is appreciated.
    ·
  • tpw_mantpw_man Posts: 276
    edited 2008-04-07 00:21
    Fonzi:
    waitcnt(100) will not work because it is waiting for the CNT register to equal 100. The correct code is: waitcnt(clkfreq/10+cnt) . That works because it is waiting for a number bigger than the current CNT value and not waiting for CNT to roll over to 0 and to 100. waitcnt is not like PBASIC's PAUSE instruction. The above example waits for the clock frequency divided by 10 or 100 ms plus the current CNT value. Adding a level shifter will make no difference. Also, the Simple_Serial object(the 'core' of the Serial_LCD object) needs 80 Mhz to run at 19200 baud. You can solve that problem by doing this at the _clkmode line: _clkmode = xtal;1+pll16x . Hope this helps smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1010, so be surprised!

    Post Edited (tpw_man) : 4/7/2008 12:41:03 AM GMT
  • FonziFonzi Posts: 17
    edited 2008-04-07 05:55
    tpw_man,

    Thanks for your reply. I tried the waitcnt you suggested and it does not work. However, using the _clkmode you suggested and playing around with it a bit more, I finally got it to work! [noparse]:)[/noparse]

    This is the code as a reference for anyone else that may have this problem:

    CON
    ·_clkmode = xtal1 + pll16x
    ·_xinfreq = 5_000_000
    OBJ
    · LCD: "Serial_Lcd"
    PUB start
    · LCD.start(16, 19200, 4)
    · LCD.str(String("······························································································ "))
    · LCD.putc($80)
    · LCD.str(String("This works."))

    Since neither the clr, gotoxy, nor home methods worked for me, I realized that I needed to find another way to implement the functionality of clr: in other words, I wanted to find a way to clear the screen and move the cursor back to the first column of the first line. The idea here is simple: print a bunch of spaces to the display (which clears it), and then move the cursor back to the "home" position with the ASCII character $80, as defined in the CON section of Serial_Lcd.

    Thanks again! [noparse]:)[/noparse]
Sign In or Register to comment.