Shop OBEX P1 Docs P2 Docs Learn Events
Display help needed 2X20 Optrex!! — Parallax Forums

Display help needed 2X20 Optrex!!

grasshoppergrasshopper Posts: 438
edited 2007-10-16 18:57 in Propeller 1
I am new to the forums as well as the propeller IC and I think both are great.

I am in disparate need of some help. I am trying to display some basic letters and numbers on a 2x20 Optrex PWB51505C-COB display. Can some one post code that will help me in my efforts? I believe it is a parallel display and fairly common.

Thanks

Comments

  • grasshoppergrasshopper Posts: 438
    edited 2007-10-10 19:59
    Some one help me. I cant believe i can put text on a monitor but not a 2X20 !!!!!
  • HarleyHarley Posts: 997
    edited 2007-10-10 20:35
    I've worked with some LCD modules with PICs, but not yet any on the Propeller.

    One important part of the effort is the proper initialization routine. Are you sure it is OK?

    How about the 'contrast' setting? Maybe the pot is too far high or low. Do you see any dark 'character' boxes? If not re-adjust that pot. You should see at least one line of the 20 char positions dark; choose a mid-dark setting.

    Usually once the 'init' is done right, it is smooth sailing. Do you have the data sheet on the module? That should help you figure out whether the init coding and delays are OK.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • hippyhippy Posts: 1,981
    edited 2007-10-10 20:37
    @ grasshopper : Have you checked the Propeller Object Exchange ... ?

    http://obex.parallax.com/objects/104/
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-10 20:38
    Grasshopper, there are some drivers available... I can upload one I received from Marcel Majoor some months ago, and I know to work. It is configured for 4-bit mode and certain control lines you can find in the constant section. You can change them.

    It is also configured as a four line display, you have to change the address offset for a 2 line display.
    It will all become clear when you read through the code!

    The demo program is configured Hydra like (10 Mhz/ 8X), as I used it for a SpinStamp

    When - and you most likely will - you run the display with 5V you should add 1k series resistors in the lines you readfrom. The demo program contains status read, but you can out-comment, when you do not need it, so saving the resistors. But I think it will do no harm with the generally low current from a typical display.

    Post Edited (deSilva) : 10/10/2007 8:44:37 PM GMT
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-11 16:20
    deSilva - Thanks for the code. It works somewhat but i still have a few questions reguarding the code and the Display.

    #1 the display can be used in 4 bit or 8 bit mode. Can someone explain the advantages / disadvantages of each mode? I am sur 8 bit mode hase more special features but i want some one to open my mind.


    # 2 the code i used from deSilva works but the lettering is incorrect and all alien looking. If i tell it HELLO i get %$M@ or something like this. Can you help me more?

    Thanks and please remember i am a student so my knowledge is growing
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-11 18:47
    #2 Please give me the precise wiring you are using. You connected what to what? It looks as if you skewed some of the data lines...

    #1 4 bit mode just sends 8 bits in two packages of 4 bits. Some people have reported that there can be initialization problems in 4 bit mode, as the display can get out of sync.
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-11 19:31
    Here is what i connected
    These are the connections I used

    These are the connections I used

    PORTA
    LCD
    PIN 1 5Volts - Anode
    PIN 2 Cathode through a 220Ohm Resistor to GND
    PIN 3 Contrast - GND
    PIN 4 5Volts
    PIN 5 RD/!WR GNDPIN 4
    PIN 6
    Register Select
    PIN 7 GND
    PIN 5
    PIN 8 Enable
    PIN 09 D0 Not connected
    PIN 10 D1 Not connected
    PIN 11 D2 Not connected
    PIN 12 D3 Not connected
    PIN 3
    PIN 13 D4
    PIN 2
    PIN 14 D5
    PIN 1
    PIN 15 D6
    PIN 0
    PIN 16 D7

    Here is the data sheet www.floodhound.com/books/515.pdf

    Some things i have tried so far: connecting the floating D0-D3 to ground but no luck, I also tried making the 4 a 2 in the in the CON section of the LCDDEMO lcdlines = 2.

    Please help.
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-11 19:51
    You seem to have reversed all the bits und used the lower I/Os rather the higher. I cannot check it at the moment but I think (from reading the source) that
    ---------------PIN 09 D0 Not connected
    ---------------PIN 10 D1 Not connected
    ---------------PIN 11 D2 Not connected
    ---------------PIN 12 D3 Not connected
    PIN 4---------PIN 13 D4
    PIN 5---------PIN 14 D5
    PIN 6---------PIN 15 D6
    PIN 7---------PIN 16 D7
    


    would work. You changed the setting in the CON section for E and RS I am sure?!

    When you want to use Pin 0 to 3 you can set CSHL to 0.

    The source code is very straight forward and easy to understand; one most likely can improve it at many places, be it just for an exercise!
  • HarleyHarley Posts: 997
    edited 2007-10-11 19:58
    First off it appears your wiring

    PIN 3
    PIN 13 D4
    PIN 2
    PIN 14 D5
    PIN 1
    PIN 15 D6
    PIN 0
    PIN 16 D7

    has the msb to lsb of the nibble swapped. D7 is the msb of the LCD's byte or high nibble. Does your code swap the nibbles? That sure could give the display fits when sending commands and produce weird characters.

    Possibly pin 3 should be connected to the tap of a potentiometer with ends at 5v and ground. Adjust pot (contrast) for some darkness on display. Fine tune once initialization is right.

    Don't understand your pin5 note of 'GNDPIN4', which you show has 5v on it?

    The LCDs I've used before mostly had the following pins assigned:
    1. Gnd
    2. 5v
    3. Vee - the contrast pin
    4. Register Select - one level used for commands on initialization, other level used for sending data to display
    5. R/W - can be grounded if don't need to ever read the display registers
    6. Enable - can be enabled all the time in some instances
    7. DB0
    ...
    14. DB7

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-11 21:18
    Harley said...


    Don't understand your pin5 note of 'GNDPIN4', which you show has 5v on it?


    Yes i can see i made a mistake posting it should


    PROP
    LCD
    PIN 1 5Volts - Anode
    PIN 2 Cathode through a 220Ohm Resistor to GND
    PIN 3 Contrast - GND
    PIN 4 5Volts
    PIN 5 RD/!WR GND
    PIN 4
    PIN 6 Register Select
    PIN 7 GND
    PIN 5
    PIN 8 Enable
    PIN 09 D0 Not connected
    PIN 10 D1 Not connected
    PIN 11 D2 Not connected
    PIN 12 D3 Not connected
    PIN 3
    PIN 13 D4
    PIN 2
    PIN 14 D5
    PIN 1
    PIN 15 D6
    PIN 0
    PIN 16 D7

    Harley I understand that i should use a potentiometer and i will during the finial design but for testing purposes it is working fine. I am not sure about the MSB. I will look into the D4-D7 pins to see if i have them correctly installed. I need a better data sheet as well unless you can see data regarding the MSB in the one i provided. I can see that my display has all of the requirements that you have listed except i am using a 16pin vs. 14 pin 2X20.

    here is what i have
    No.........Symbol..........Function
    1...........LED (A)..........LED Anode Terminal
    2...........LED (K)..........LED Cathode Terminal
    3...........VSS...............Power Supply (0V, GND)
    4...........VCC...............Power Supply for Logic
    5...........VEE...............Power Supply for LCD Drive
    6.......... RS.................Register Select Signal
    7...........R/W...............Read/Write Select Signal H : Read L : Write
    8...........E...................Enable Signal (No pull-up Resister)
    9...........DB0...............Data Bus Line / Non-connection at 4-bit operation
    10.........DB1...............Data Bus Line / Non-connection at 4-bit operation
    11.........DB2...............Data Bus Line / Non-connection at 4-bit operation
    12.........DB3...............Data Bus Line / Non-connection at 4-bit operation
    13.........DB4...............Data Bus Line
    14.........DB5...............Data Bus Line
    15.........DB6...............Data Bus Line
    16.........DB7...............Data Bus Line

    [noparse]:)[/noparse]
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-11 21:25
    Grasshopper, I am not sure whether you made the changes I posted!? Does it run now?

    All datashets contain equal information. The HD44780 (or compatibles) has not changed for 20 years now smile.gif , neither has the pin-out...
    And there is enough informtaion in the source code I think.
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-11 22:10
    deSilva said...
    You seem to have reversed all the bits und used the lower I/Os rather the higher. I cannot check it at the moment but I think (from reading the source) that
    ---------------PIN 09 D0 Not connected
    ---------------PIN 10 D1 Not connected
    ---------------PIN 11 D2 Not connected
    ---------------PIN 12 D3 Not connected
    PIN 4---------PIN 13 D4
    PIN 5---------PIN 14 D5
    PIN 6---------PIN 15 D6
    PIN 7---------PIN 16 D7
    


    would work. You changed the setting in the CON section for E and RS I am sure?!

    When you want to use Pin 0 to 3 you can set CSHL to 0.

    The source code is very straight forward and easy to understand; one most likely can improve it at many places, be it just for an exercise!


    I have not made the changes yet but i am eager to do so now that i think i understand you. Before i make the change do i need to specify in the code that i am using a 2X20 because i think the code states it will run up to a 4X20.

    I am excited now thanks deSilva for all your help.
  • hippyhippy Posts: 1,981
    edited 2007-10-11 23:00
    grasshopper said...
    #1 the display can be used in 4 bit or 8 bit mode. Can someone explain the advantages / disadvantages of each mode? I am sur 8 bit mode hase more special features but i want some one to open my mind.
    The LCD has the same features and functionality regardless of whichever mode you use.

    4-bit : Pro's - Only four data lines needed, unused lines can be used for something else. Fewer lines to wire-up Con's - It takes two writes to the LCD display to send data bytes, slower than 8-bit mode.

    8-bit : Pro's - Only a single write needed to send data bytes, quicker than 4-bit mode. Con's - Needs 8 lines available, all used for data transfer, more lines to wire-up.
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-12 08:05
    There is no different address offset for the first 2 lines; on 4 line display there is a difference whether you have 16 or 20 characters ; if needed have a look into the code near gotoXY; easy to modify...

    Also note the fine LOOKUP statement. Somehow LOOKUP and LOOKDOWN are rarely used in code I have seen...
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-14 12:05
    As I had to do it for my class anyhow:

    The configuration in Marcel's driver is
    CRs        = 9                                           ' Connected I/O for RS signal
    CRw        = 10                                          ' Connected I/O for RW signal
    CE         = 11                                          ' Connected I/O for E  signal
    CShl       = 12
    


    The images will explain the rest.
    The nice application shows decoding pulse dialing from an surplus dial plate @ 90 cents. BTW: The internals of it are a masterpiece of mechanics...

    Edit:
    The pin-outs of all 44780 compatible displays are the same. In most cases there are pins 15 and 16, either - logically - following pin 14, but also can be allocated before pin 1! They are sometimes also marked A(node) and K(athode) for background lighting
    Note that in low-cost displays (sub $5), there is no bg lighting installed, but there is space and pads to add it (for the same price again smile.gif )

    Post Edited (deSilva) : 10/14/2007 12:30:17 PM GMT
    760 x 500 - 69K
    575 x 500 - 48K
    670 x 507 - 49K
  • hippyhippy Posts: 1,981
    edited 2007-10-14 21:20
    deSilva said...
    The pin-outs of all 44780 compatible displays are the same.
    Most are but not all. "44780 compatible" usually refers to the command set, not necessarily the pinout configuration.
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-14 22:31
    True, hippy; but I have never seen anything but the 14 pins, sometimes 2 added for A/K either at the left side or at the right side smile.gif
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-15 20:59
    Thanks everyone for helping me get my display running. My problem was that i did have 0-3 backwards. I resolved the problem by switching the pins as follows

    Propeller
    Display
    0.....................13
    1.....................14
    2.....................15
    3.....................16

    As a side note the Object shows a wiring diagram and it is backwards for my display. I dont know if this is for all 2X20's but it was for mine
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-15 23:19
    The wiring in the source code seems o.k. to me, and as I already said: There are no known pin-outs other than the "usual" one.
    But there can always be misunderstandings, so I undertook the major effort to shoot those photographs smile.gif

    BTW: It might be that those were the "counted" pins 13,14,15,16, but I am rather sure there are small numbers somewhere on the display PCB saying those are pins 11, 12, 13, and 14.

    Post Edited (deSilva) : 10/15/2007 11:25:07 PM GMT
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-16 15:00
    I am now messing around with characters and i need some help. I want to put on the display the degree symbol. I would like to use the string like this one

    LCD.writeOut($08)
    



    or what ever the degree symbol is in Hex $08 is not it.

    Please fill me in.
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-16 17:34
    You should have enough examples how to make your own characters in the accompanying DEMO source code in my posting...

    The codes already available are generally printed in the data sheet. codes 128 to 255 generally consist of Kanji characters..

    All right, all right.. here you are.

    Post Edited (deSilva) : 10/16/2007 5:50:28 PM GMT
    610 x 715 - 132K
  • grasshoppergrasshopper Posts: 438
    edited 2007-10-16 18:57
    Man that chart is perfect. Thanks a million,,
    jumpin.gif
Sign In or Register to comment.