PDA

View Full Version : LCD displays black boxes!!!!



pt3rg
- 26th November 2003, 09:00
I've connected a Hitachi 44780 LCD to a 16F84 exactly the same way as shown in the manual's page 94(pdf version).

This is my program:
DEFINE LCD_DREG PORTA
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2

TRISB.0 = 0
PAUSE 2000
LOOP:
LCDOUT $FE,1,"hello"
PORTB.0 = 1 'LED on
PAUSE 500
LCDOUT $FE,1
PORTB.0 = 0 'LED off
PAUSE 500
GOTO LOOP
END


When i tested it, the LED blinks but the LCD displays black boxes instead of "hello". HELP!!!! I've been trying to solve this problem for weeks!!!!! btw, i'm using PBP v2.40

Melanie
- 26th November 2003, 20:40
Some suggestions...

1. Have you remembered the pull-up Resistor on RA4? On any other pin you can dispose with it, but if you use RA4 then it's gotta be there.

2. You sure you haven't got anything miss-wired? RA0 goes to DB4... easy to mistake and connect it to DB0... RS-bit and E-bit are easily cross-connected to the wrong pins...

3. Is your contrast set so dark that everything is blacked-out?

Melanie

Squibcakes
- 27th November 2003, 05:09
Number 1 trap for young players... ;) Read page 189

For 4-bit interface data, only four bus lines (DB4 to DB7) are used for transfer.

Bus lines DB0 to DB3 are disabled.

So connect the Pic to DB4 to DB7, and recode your program,

DEFINE LCD_DBIT 4 'Use DB4 DB5 DB6 DB7


See how you go.



J

pt3rg
- 27th November 2003, 12:14
Originally posted by Melanie
Some suggestions...

1. Have you remembered the pull-up Resistor on RA4? On any other pin you can dispose with it, but if you use RA4 then it's gotta be there.
Oh yes.... definitely


2. You sure you haven't got anything miss-wired? RA0 goes to DB4... easy to mistake and connect it to DB0... RS-bit and E-bit are easily cross-connected to the wrong pins...
Checked it many times. The connections are correct.


3. Is your contrast set so dark that everything is blacked-out?

When i turned the pot from one extreme to the other, the display changes from nothing to ........you've gussed it!!! black boxes......

Originally posted by Squibcakes
Number 1 trap for young players... ;) Read page 189

For 4-bit interface data, only four bus lines (DB4 to DB7) are used for transfer.

Bus lines DB0 to DB3 are disabled.

So connect the Pic to DB4 to DB7, and recode your program,

DEFINE LCD_DBIT 4 'Use DB4 DB5 DB6 DB7


See how you go.



J
Changed it. Nothing is displayed on the LCD. If i put
DEFINE LCD_DBIT 0 , then black boxes reappear.