Sonsivri

Electronics => Pic C Languages => Topic started by: Sepiroth on April 05, 2010, 02:53:43 14:53



Title: Need Help for LCD Driver
Post by: Sepiroth on April 05, 2010, 02:53:43 14:53
Hi all,
I'm trying to drive a 4x20 LCD with KS0066 chipset using a PIC18F6520 & HiTech PICC18 9.63 Pro. I've connected control and data pins on the same port (PORTF, 7-4 Data, 3 Rs 2 Rw 1 En 0 Backlight) of the pic. So far I've managed to get LCD to work, but whenever I reset PIC, it doesnt display at all. After resetting second time, it works, so its like its randomly working (something like works every 7 out of 10 resets). What may cause the problem? I've attached the lcd driver that im using. Thanks in advance,


Title: Re: Need Help for LCD Driver
Post by: pickit2 on April 05, 2010, 03:06:14 15:06
I only use C when made to, but 10ms to let things settle down is a bit low. your starting pic and jumping to LCD, try 100ms delay at start up. (200ms would be better)
here is start up for lcd in proton sample
Code:
       ' SET UP LCD 4-bit Interface
        LCD_DTPin = PORTC.0
LCD_RSPin = PORTC.5
LCD_ENPin = PORTC.4
LCD_Interface = 4     ' 4-bit Interface
LCD_Lines = 2
LCD_Type = 0
LCD_CommandUs = 2000
LCD_DataUs = 50


Title: Re: Need Help for LCD Driver
Post by: Sepiroth on April 05, 2010, 03:19:25 15:19
Hi again,
I'm using a 10MHz xtal with PLL to make it 40MHz, at the main code i already put a 250ms delay, after that i try to init lcd. what makes me crazy is, if i increase the delay, it crashes, if i decrease the delay time, it crashes again, thats where i stucked tbh:') i


Title: Re: Need Help for LCD Driver
Post by: TomJackson69 on April 12, 2010, 06:43:11 18:43
Sepiroth,

Is your program works now?
Still need help? If so, post your complete program or at least your main function.
Also the LCD part number or made.

Tom