View previous topic :: View next topic |
Author |
Message |
cam_male2003
Joined: 21 Sep 2005 Posts: 12
|
LCD Init problem I changed my Xtal speed from 3.68mhz to 25 |
Posted: Fri May 19, 2006 6:37 am |
|
|
I researched this in the forum and tried removing the tris, removing the fast IO, and still have the same issue. The display comes up blank or two rows of squares. After I reset the unit multiple times I can get it to come up correctly. I am using a Datamodul Display 4 lines 20 characters each. I am at a lose... I know the processor is working because the USB is echoing my data in hyperterminal. The processor is Microschip pic18lf8722. Complier is 3.249.
Code: |
#define lcd_rs pin_b0 // O lcd register select control line
#define lcd_rw pin_b1 // O lcd read/write
#define lcd_en pin_b2 // O lcd enable control line
#define lcd_data_4 pin_J4 // O lcd data pin
#define lcd_data_5 pin_J5 // O lcd data pin
#define lcd_data_6 pin_J6 // O lcd data pin
#define lcd_data_7 pin_J7 // O lcd data pin
#define lcd_busy pin_J7 // I lcd busy
void LCDInit()
{
output_bit(lcd_data_4,0);
output_bit(lcd_data_5,0);
output_bit(lcd_data_6,0);
output_bit(lcd_data_7,0);
output_bit(lcd_rs,0);
output_bit(lcd_rw,0);
output_bit(lcd_en,0);
delay_ms(50);
output_bit(lcd_pwr,1); // Turn on LCD //
delay_ms(100);
lcd_on=1;
send_nibble(0x30);
delay_ms(50);
send_nibble(0x30);
delay_ms(10);
send_nibble(0x30);
delay_ms(10);
send_nibble(0x20);
sendLCDInstruction(0x28); // 4 bit data-2 lines-5x7 dots
delay_ms(5);
sendLCDInstruction(0x0c); // display on, no cursor, no blink
delay_ms(5);
//restart_wdt();
LCDClear();
}
|
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri May 19, 2006 11:52 am |
|
|
Don't write your own LCD driver, or at least don't do it initially.
Use an existing driver such as the CCS driver, LCD.C, which is in
this folder: c:\Program Files\PICC\Drivers
Or use one of the LCD drivers in the Code Library forum:
http://www.ccsinfo.com/forum/viewforum.php?f=2 |
|
![](templates/subSilver/images/spacer.gif) |
cam_male2003
Joined: 21 Sep 2005 Posts: 12
|
|
Posted: Mon May 22, 2006 10:49 am |
|
|
I will try that, thanks
![Rolling Eyes](images/smiles/icon_rolleyes.gif) |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon May 22, 2006 11:48 am |
|
|
Just checking. What is the voltage you are running off?
According to the datasheet, figure 28-3, you'll need at least 3.3V at 25MHz for stable operation. |
|
![](templates/subSilver/images/spacer.gif) |
|