4 x 20 LCD display with PB3 - Pin 5 High or Low?


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2011
    Location
    East Coast USA
    Posts
    16

    Default 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    Hi, I've searched the forum and the documentation for PB3 and the displays, but I'm still confused.

    Page 171 of the PB3 manual shows pin 5 of the LCD module tied to ground and page 172 shows the pin tied high. Which is correct?

    I tried a simple program to clear the display and show 'READY'. The program then goes on to repeatedly flash an LED. If I comment out the Lcdout lines, the LED flashes. With the Lcdout line in place, the program hangs and the LED doesn't flash.

    Can someone suggest a place for further research?

    Thanks.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    The R/W pin should be tied to ground for writing to the display.

    The schematic that shows it tied to VDD was my fault.
    It has already been corrected for future manuals.
    DT

  3. #3
    Join Date
    Oct 2011
    Location
    East Coast USA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    Thanks Darryl,

    Silly question: Is there feedback from the display to the Lcdout routine (I'm thinking of the 4 bit communication) or is the pic blindly sending data to the LCD and relying on timing for the LCD to grab data?

    Thanks again.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    No, there is no feedback to the LCDOUT routines.

    If the program stops or the chip resets when trying to display things, it could be that you have LVP enabled in the configs, and the LCD uses the PGM pin.
    DT

  5. #5
    Join Date
    Oct 2011
    Location
    East Coast USA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    leThanks for all the help, but I'm still stuck. I wired the LCD as shown on page 172 of the PB3 manual.

    After giving up with my code, I tried the example supplied with the compiler. The display still remains blank. I've adjusted the contrast, I proved that the display works by connecting it to a Midibox 8-bit core. I've tried RT(AT)FM (AT=All The) many times and the display remains as blank as my feeble brain.

    Here's the last code I compiled and burned. I've turned off the watchdog timer, set the oscillator to INTOSCIO. The 887 manual says the internal oscillator defaults to 4MHz, but the example assumes an 4MHz external crystal, so that should work, shouldn't it?

    The only differences I can see are 1) that Page 172 shows r/w on the LCD tied low, and the example seems to indicate that the R/W line is tied to port E.2 and is set low in the program. 2) I'm using the internal oscillator, 3) I'm using a 4x20 display rather than a 4-line display, but ignoring the extra two lines for now. 4) I'm using a breadboard, not the Lab-X1 board.

    I don't know what else to try.

    Help!


    The code:
    -------------------------------------------------------------
    ' Name : LCDX.pbp
    ' Compiler : PICBASIC PRO Compiler 3.0.6.4
    ' Assembler : PM or MPASM
    ' Target PIC : 40-pin 16F887
    ' Hardware : LAB-X1 Experimenter Board
    ' Oscillator : 4MHz external crystal
    ' Keywords : LCDOUT
    ' Description : PICBASIC PRO program to display "Hello World" on
    ' LAB-X1 LCD.
    '

    ' Define LCD registers and bits
    Define LCD_DREG PORTD
    Define LCD_DBIT 8
    Define LCD_RSREG PORTE
    Define LCD_RSBIT 0
    Define LCD_EREG PORTE
    Define LCD_EBIT 1

    ANSEL = %00000000 ' Make AN0-AN7 digital
    ANSELH= %00000000 ' Make AN8-AN13 digital
    Low PORTE.2 ' LCD R/W line low (W)
    Pause 100 ' Wait for LCD to start up

    mainloop:
    Lcdout $fe, 1 ' Clear screen
    Pause 500 ' Wait .5 second

    Lcdout "Hello" ' Display "Hello"
    Pause 500 ' Wait .5 second

    Lcdout $fe, $c0, "World" ' Move to line 2 and display "World"
    Pause 500 ' Wait .5 second
    Goto mainloop ' Do it forever

    End
    Last edited by xpa999; - 29th March 2014 at 18:23. Reason: left out info

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    Quote Originally Posted by xpa999 View Post
    I wired the LCD as shown on page 172 of the PB3 manual.
    But your LCD DEFINEs don't match what is on page 173.
    DT

  7. #7
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    Quote Originally Posted by xpa999 View Post
    Define LCD_DREG PORTD
    Define LCD_DBIT 8
    This is part of your problem. If you are using a 4 bit bus, this would be either 0 or 4 - the starting bit of the D4 line. If an eight bit bus, it would be 0
    "I have noticed that even those who assert that everything is predestined and that
    we can change nothing about it still look both ways before they cross the street"


    -Stephen Hawking

  8. #8
    Join Date
    Oct 2011
    Location
    East Coast USA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    Thanks for the help, but...

    The define I actually used was

    Define LCD_DREG PORTD
    Define LCD_DBIT 0

    The '8' appeared as an artifact of my clumsy attempt to paste the code into the message.

    As far as the 'missing' defines from page 173, they are listed on page 170 of the PBP3 manual as the defaults, so they shouldn't be needed. But... I copied the defines straight from the manual, put them in my code and the result was the same - not working.

    I put in some code to flash an LED on portc.3 to confirm that the program was actually running. It is. The LED is flashing at the rate I would expect from the OSC frequency and pause statements.

    I've triple checked that I have the appropriate .1uf capacitors across Vss and Vdd at the pins on the 887.

    I've checked that the 20k trimmer is providing 0 to 5V to pin 3 of the display. I've tried adjusting the trimmer from one end to the other. The only display is a complete line of filled boxes on the first line and nothing on the second line.

    I have checked the wiring from the chip pins to the LCD pins with an ohmmeter: They are connected as expected and there appear to be no shorts or cross-connections. I've checked Vdd to be at 5.1 volts (within spec). Unfortunately, my 'scope is out for repair so I can't really check the timing. My trusty (single line) logic probe shows activity on all of the LCD data pins and the RS and E pins.

    I've messed with the timing defines, tried two different LCDs of different manufacture and two different 887 chips. As I said before, both LCDs work correctly with a pic-based MIDIBox core module.

    The LCDs are 4 line x 16 character. I've tried both DEFINE LCD_LINES 2 and DEFINE LCD_LINES 4. Neither worked.

    Needless to say I am very frustrated. It must be something simple I am missing, but I am at a loss. Has anyone actually tried these routines in PBP V3 and gotten them to work?

    LCD Test v1-3a.txt
    Attached Files Attached Files
    Last edited by xpa999; - 31st March 2014 at 19:12. Reason: wrong attachment

  9. #9
    Join Date
    Oct 2011
    Location
    East Coast USA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: 4 x 20 LCD display with PB3 - Pin 5 High or Low?

    AAAAAAAHHHHHHHHH!

    Sorry guys, in my haste, I kept comparing my wiring to the diagram on Page 172, and tied the R/W pin High rather than Low per Darryl's reply. I heard the words, but my eyes saw the diagram. It's working fine now.

Similar Threads

  1. 4x40 LCD Display Enable Pin
    By rsocor01 in forum General
    Replies: 2
    Last Post: - 10th August 2011, 02:50
  2. Use of HIGH and LOW for pin outputs
    By rnuke77 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th January 2011, 18:40
  3. Replies: 5
    Last Post: - 14th May 2010, 03:21
  4. Reading if Pin is High or Low?
    By Spindle in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 1st August 2005, 17:39
  5. Replies: 0
    Last Post: - 25th May 2005, 10:35

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts