|
|
View previous topic :: View next topic |
Author |
Message |
s7en Guest
|
LCD Hardware not working properly |
Posted: Thu Jan 22, 2009 2:06 am |
|
|
Hi, I'm running a program for LCD (as below). The simulation working properly but when running on hardware the display appear intermittently. Most of the times LCD show full block display on first row. I need to touch the IC leg 1 and 2 and suddenly the display appear.
Please help!
Code: | #include <16f877a.h>
#use delay (clock = 20000000)
#fuses hs,noprotect,nowdt,nolvp
#BYTE PORTA=5
#BYTE PORTB=6
#BYTE PORTC=7
#include <flex_lcd.c>
void main()
{
set_tris_a (0);
lcd_init();
lcd_gotoxy(1, 1);
lcd_putc("VOTE\n");
delay_ms(1000);
lcd_putc("READY\n");
while(TRUE)
{
int8 value;
value = input_b();
switch(value)
{
case 0b00000001: lcd_putc("Yes"); break;
case 0b00000011: lcd_putc("No"); break;
}
delay_ms(100);
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 22, 2009 2:22 pm |
|
|
Quote: | I need to touch the IC leg 1 and 2 and suddenly the display appear | .
1. On the LCD, those pins are the Ground and Power pins. On the PIC,
pin 1 is the MCLR pin. You need to fix your hardware. Check the wires
and make sure you have good connections. Make sure you have a
pull-up resistor on the MCLR pin of the PIC.
2. The lcd advances the cursor after each character is displayed with
the lcd_putc() function. After a few characters are displayed in your
while() loop, the LCD cursor will be off the screen. You need to reset
the cursor to coordinates (1, 1) at the start of the while() loop. |
|
|
Guest
|
|
Posted: Fri Jan 23, 2009 12:56 am |
|
|
thanks! i wired wrong to MCLR. The problem solved. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|