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

OSEPP LCD Help

vangbevangbe Posts: 21
edited 2016-09-16 13:39 in General Discussion
I just brought this a few days ago at MicroCenter and I don't know how to Send Information to it.

http://osepp.com/products/accessories/16x2-lcd-display/

It's on P0 - P 15

This is what I know..
P0 = VSS = Negative/Ground
P1 = VDD = Positive/Supply of 5 volts
P2 = V0 = Contrast Adjustment
P3 = RS = REGISTER SELECT SIGNAL
P4 = RW = READ/WRITE
P5 = E = ENABLE SIGNAL
P6 - P10 = 4 LOW DATA LINES
P11 - P14 = 4 HIGH DATA LINES
P15 = (Backlight+)
P16 = (Background-)

I hooked up P0 to VSS, P1 to VDD, P16 to VSS, P15 to VDD.
I can turn it on and off, but I don't know how to use the V0,RS,RW,E and the other functions. I also don't know how to code it to slowly turn on the backlight and turn off the backlight.

I'm using
' {$STAMP BS2}
' {$PBASIC 2.5}

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    I have posted links to the now discontiued StampWorks manual which can be downloaded in PDF format as well as a link to the source code. It describes how to communicate with a Parallel Character LCD such as yours.

    https://www.parallax.com/downloads/stampworks-experiment-kit-manual

    https://www.parallax.com/downloads/stampworks-basic-stamp-source-code
  • Thanks, I'm just curious, if this is outdated, than what's the latest one?
  • The StampWorks Kit is discontinued. There are no new updates.

    Chris linked to the latest files.
  • I just tried it and I'm not getting anything.

    I'm using the BoeBot kit btw..
    The LCD I got is just because I want to try something out. If I'm correct, the board that comes with the BoeBot kit is different from the one that comes with the StampWorks kit
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2016-09-16 20:08
    The board is different, but it is still a BASIC Stamp 2 and if the connections are made to the same I/O pins, power, ground and the contrast pin, then it should work with the same code.

    Speaking of which, many people actually get these LCDs working, but don't realize it because the contrast is so low they can't see anything on the display.
  • vangbevangbe Posts: 21
    edited 2016-09-19 01:06
    I went to
    https://www.parallax.com/downloads/stampworks-basic-stamp-source-code

    and download one of the files and used the "SW21-EX11-LCD_DEMO.BS2"
    ' =========================================================================
    '
    ' File....... SW21-EX11-LCD_Demo.BS2
    ' Purpose.... Essential LCD control
    ' Author..... (C) 2000 - 2005, Parallax, Inc.
    ' E-mail..... support@parallax.com
    ' Started....
    ' Updated.... 15 AUG 2006
    '
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    ' =========================================================================


    '
    [ Program Description ]
    '
    ' This program demonstrates essential character LCD control.
    '
    ' The connections for this program conform to the BS2p-family LCDCMD,
    ' LCDIN, and LCDOUT instructions. Use this program for the BS2, BS2e,
    ' or BS2sx. There is a separate program for the BS2p, BS2pe, and BS2px.


    '
    [ I/O Definitions ]

    E PIN 1 ' Enable pin
    RW PIN 2 ' Read/Write
    RS CON 3 ' Register Select
    LcdBus VAR OUTB ' 4-bit LCD data bus


    '
    [ Constants ]

    LcdCls CON $01 ' clear the LCD
    LcdHome CON $02 ' move cursor home
    LcdCrsrL CON $10 ' move cursor left
    LcdCrsrR CON $14 ' move cursor right
    LcdDispL CON $18 ' shift chars left
    LcdDispR CON $1C ' shift chars right

    LcdDDRam CON $80 ' Display Data RAM control
    LcdCGRam CON $40 ' Character Generator RAM
    LcdLine1 CON $80 ' DDRAM address of line 1
    LcdLine2 CON $C0 ' DDRAM address of line 2


    #DEFINE _LcdReady = ($STAMP >= BS2P)


    '
    [ Variables ]

    char VAR Byte ' character sent to LCD
    idx VAR Byte ' loop counter


    '
    [ EEPROM Data ]

    Msg DATA "The BASIC STAMP!", 0 ' store message


    '
    [ Initialization ]

    Check_Stamp:
    #IF (_LcdReady) #THEN
    #ERROR "Please use BS2p version: SW21-EX11-LCD_Demo.BSP"
    #ENDIF

    DIRL = %11111110 ' setup pins for LCD
    PAUSE 100 ' let the LCD settle

    Lcd_Setup:
    LcdBus = %0011 ' 8-bit mode
    PULSOUT E, 3
    PAUSE 5
    PULSOUT E, 3
    PULSOUT E, 3
    LcdBus = %0010 ' 4-bit mode
    PULSOUT E, 1
    char = %00001100 ' on, no crsr, no blink
    GOSUB LCD_Cmd
    char = %00000110 ' inc crsr, no disp shift
    GOSUB LCD_Cmd


    '
    [ Program Code ]

    Main:
    char = LcdCls ' clear the LCD
    GOSUB LCD_Cmd
    PAUSE 500
    idx = Msg ' get EE address of message

    Write_Message:
    DO
    READ idx, char ' get character from EE
    IF (char = 0) THEN EXIT ' if 0, message is complete
    GOSUB LCD_Out ' write the character
    idx = idx + 1 ' point to next character
    LOOP
    PAUSE 2000 ' wait 2 seconds

    Cursor_Demo:
    char = LcdHome ' move the cursor home
    GOSUB LCD_Cmd
    char = %00001110 ' turn the cursor on
    GOSUB LCD_Cmd
    PAUSE 500

    char = LcdCrsrR
    FOR idx = 1 TO 15 ' move cursor l-to-r
    GOSUB LCD_Cmd
    PAUSE 150
    NEXT

    FOR idx = 14 TO 0 ' move cursor r-to-l by
    char = LcdDDRam + idx ' moving to a specific
    GOSUB LCD_Cmd ' column
    PAUSE 150
    NEXT

    char = %00001101 ' cursor off, blink on
    GOSUB LCD_Cmd
    PAUSE 2000

    char = %00001100 ' blink off
    GOSUB LCD_Cmd

    Flash_Demo:
    FOR idx = 1 TO 10 ' flash display
    char = char ^ %00000100 ' toggle display bit
    GOSUB LCD_Cmd
    PAUSE 250
    NEXT
    PAUSE 1000

    Shift_Demo:
    FOR idx = 1 TO 16 ' shift display
    char = LcdDispR
    GOSUB LCD_Cmd
    PAUSE 100
    NEXT
    PAUSE 1000

    FOR idx = 1 TO 16 ' shift display back
    char = LcdDispL
    GOSUB LCD_Cmd
    PAUSE 100
    NEXT
    PAUSE 1000

    GOTO Main ' do it all over


    '
    [ Subroutines ]

    LCD_Cmd:
    LOW RS ' enter command mode


    LCD_Out:
    LcdBus = char.HIGHNIB ' output high nibble
    PULSOUT E, 3 ' strobe the Enable line
    LcdBus = char.LOWNIB ' output low nibble
    PULSOUT E, 3
    HIGH RS ' return to character mode
    RETURN

    And this is my set up.. (ignore the LED and other wires)

    For this specific code, I hooked up the..
    - VSS pin to VSS
    - VD0 pin to VDD
    - RS pin to pin 3
    - RW pin to pin 2
    - E pin to pin 1
    - A pin to VDD
    - K pin to VSS

    It's not working. Am I missing something?
    Where am I suppose to connect the D0 - D7 pins?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2016-09-19 15:46
    Actually, it looks like your power connections may be wrong, which also may make your display unreadable. Also, even if the control lines are connected correctly, you have no data lines at all, meaning there is no communication with the display.

    Here's a diagram I found on the web which shows the connection for a parallax LCD. Notice the power and contrast connections? Also note the data pins?

    serial-vs-parallel.PNG

    P.S. - As a note, connecting pins 15 and 16 will always make the backlight come on, but the backlight is not controlled by nor connected to the display logic in any way. In other words, it isn't an indicator of anything working as far as the display itself goes. It's just some LEDs behind the display. Also note that quite often those pins need a series resistor to limit current to the backlight.
  • vangbe,

    I was unable to get into the OSEPP forum and I didn't see a datasheet or instructions for this LCD.

    Look at the wiring diagram on page 75 (85 of the PDF) of the StampWorks manual to see how the LCD data lines are wired to the BS2.
    Notice that P4 goes to D4 (Pin 11 of your LCD), P5 to D5 (Pin 12), P6 to D6 (Pin 13), and P7 to D7 (Pin 14)
    This uses only the 4 Data High lines and assumes your LCD uses the Hitachi HD44780 or is compatible.

    The Parallax LCD documentation uses a 10K potentiometer to adjust the contrast.
  • vangbevangbe Posts: 21
    edited 2016-09-22 01:41
    Actually, it looks like your power connections may be wrong, which also may make your display unreadable. Also, even if the control lines are connected correctly, you have no data lines at all, meaning there is no communication with the display.

    Here's a diagram I found on the web which shows the connection for a parallax LCD. Notice the power and contrast connections? Also note the data pins?

    serial-vs-parallel.PNG

    Perhaps I just don't know how to read the schematic.
    Is their a site to help me better my understanding on that particular area?

    From my understanding of that photo, I'm assuming D7 is suppose to be connected to P7 & VSS (ground)? Correct? or is it suppose to be connected to ONLY P7? All the Greens are confusing me..

    I'm not interested in fixing the contrast with a potentiometer. I was hoping I can dim the contrast a bit with only the programming; if possible.
  • vangbe,

    Only the crosses with dots are connected together, so D7 is NOT connected to VSS.

    You could use a Digital Potentiometer to control the contrast from your program, but doing so would take a few more I/O lines.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    It may be easier for you to use a Serial LCD display rather than the one you have. You require, at minimum, 6 I/O pins (7 with R/W) plus the power and contrast connections just to get the display up an running, not counting the code to make it do things. With most Serial displays simply sending serial data is sufficient to print text.
Sign In or Register to comment.