I am hooking up PIC 18F4525 to a parallel LCD screen which has HD44780 controller (16X2). I am just trying to test the connection and the working of the LCD by writing a code which displays a one line test statement. I am using Micro Code Studio.
The LCD screen shows black boxes. I also hooked up a 20K pot to adjust the contrast. The LCD lights up...but doesn't display anything. The PIC is working fine by itself, I tested it. But its not communicating with the LCD.
I think the problem has something to do with the clock/oscillator. I just have a DEFINE OSC statement specifying the speed of the internal oscillator.
Do I need to connect an external resonator (20MHz) to the two OSC pins of the PIC ? If so, how do I do it ? Do I need to add something to my code ? How ?
I dont have any knowledge of how external resonators work......Please help.
Here is the code -
DEFINE OSC 20
'******Setting up the LCD display******
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
'DEFINE LCD_COMMANDUS 2000
'DEFINE LCD_DATAUS 50
TRISB=0
LCDOUT $FE, 1
LCDOUT "PIC - LCD Test "
LCDOUT $FE, $C0
STOP
END
Bookmarks