mrslv
Joined: 17 Feb 2011 Posts: 1
|
pic18f4580 and LCD on port d |
Posted: Thu Feb 17, 2011 8:00 am |
|
|
I am trying to drive LCD with 18f4580 on port d but with no success. I use driver that comes with 4.114 ccs compiler. This driver works fine for me with 16f876 on port b and 18f67j60 with pin access on two ports.
I want to know if there is some known issues about LCD, 18f4580 and port d.
Sometime LCD doesn't initialize. Sometime LCD shows some wrong symbols on a random places in a period of 3 sec (according to code).
Code: |
#include <18F4580.h>
#fuses HS,NOPROTECT,NOLVP,NOWDT
#use delay(clock=20M)
#define LCD_DATA_PORT getenv("SFR:PORTD")
#include "LCD.c"
void main() {
set_tris_e (0x00);
set_tris_d(0x00);
delay_ms(100);
lcd_init();
delay_ms(100);
printf(lcd_putc,"\f123456789");
delay_ms(3000);
while(TRUE)
{
output_low(PIN_A2);
printf(lcd_putc,"\fLow");
delay_ms(3000);
output_high(PIN_A2);
printf(lcd_putc,"\fHigh");
delay_ms(3000);
}
}
|
I change the MCU and now everything works fine. I also order another MCU and check again to see if everything is fine with 3rd MCU or with second i was lucky |
|