Crazy LCD

Today I’m trying to get my PIC to talk to a HD44780 LCD. It’s not quite working. My code runs fine in the simulator, but in real life it prints garbage

I’m using the included PICC-Lite LCD library, which tells you to connect PORTA2 to RS, PORTA3 to EN, and PORTB4-7 to the high bits of the 8bit LCD interface.

My code should print “Test!”, wait, clear the LCD, wait, then repeat. Instead, it prints “L@JD” over and over.

My code looks something like this:

#include <pic.h> #include "lcd.h" #include "delay.h" __CONFIG( WDTDIS & HS & UNPROTECT & PWRTEN); main() { TRISA = 0; TRISB = 0; lcd_init(); DelayMs(500); lcd_clear(); while(1 == 1) { lcd_puts("Test!"); DelayMs(500); lcd_clear(); DelayMs(500); } }
September 08, 2005
bigsight profiles | HomeTalk tours - virtual home tours