I bought several 16x2 LCD displays on eBay. They are HD44780 compatible. My pic is has an internal IRC OSC capable of 31KHz, 250Khz, 500khz, 1Mhz, 4mhz, 8mhz and 16mhz.
I have tested the displays with 250khz to 16mhz. And it works fine on all frequencies except 16mhz.
At 16MHZ, it sort of works but displays either all or some garbage characters.
I am guessing the problem is a timing issue. Could it be the internal IRC is just unstable at 16MHZ? I do not have a 16MHZ crystal on hand.
Here is my code for my delay at 16MHZ. It appears to be accurate.
I have tested the displays with 250khz to 16mhz. And it works fine on all frequencies except 16mhz.
At 16MHZ, it sort of works but displays either all or some garbage characters.
I am guessing the problem is a timing issue. Could it be the internal IRC is just unstable at 16MHZ? I do not have a 16MHZ crystal on hand.
Here is my code for my delay at 16MHZ. It appears to be accurate.
Rich (BB code):
extern unsigned char macro_delay;
#define delay_us(a) _asm movlw a\
movwf macro_delay,1\
loop: nop\
decfsz macro_delay,1,1\
bra loop\
_endasm
void delay_ms(unsigned int x);
unsigned char macro_delay;
void delay_ms(unsigned int x)
{unsigned int i;
for(i=0; i<x;i++)
{
delay_us(200);
delay_us(200);
delay_us(200);
delay_us(200);
delay_us(200);
}
}