im interfacing lcd with pic16f877. the problem is the program runs perfectly in proteus and PICmicro dev. board. But when i use it with pcb hardware, the lcd does not work at all. only it lits up. Multimetee=r readings show that most of the µcontrollr outputs are floating near 1.27V instead of having 5v or 0v. I have verified pcb connections, reset, power and ground voltages. Plz kindly help me. i have tried everything to locate the problem......
the mistakes are on the 2nd, 25th and 63rd lines of the lcd code, and 4th line down from the middle in the lcd routine, as well as wiring around the lcd.
seriously, if you are looking for specific help, you got to be specific on what you are doing and what issues you are running into.
Otherwise, it is incredibly difficult to be specific with your problems and provide you with specific solutions.
i m using jhd162a lcd, and here is the code
#include<pic.h>
void LCD_init(void);
void LCD_busy(void);
void LCD_command(unsigned char);
void LCD_senddata(unsigned char);
void main()
{
TRISD=0x00; //Setting port direction
TRISB=0x00;
LCD_init();
LCD_command(0xC0);
LCD_senddata('C');
LCD_senddata('O');
LCD_senddata('U');
LCD_senddata('N');
LCD_senddata('T');
while(1);
}
void LCD_init()
{
LCD_command(0x38);
LCD_command(0x0C);
}
void LCD_busy()
{ TRISD=0x80;
LCD_en = 1; // Make port pin as o/p
LCD_rs = 0; // Selected command register
LCD_rw = 1; // We are reading
while(RD7){ // Read busy flag again and again till it becomes 0
LCD_en = 0; // Enable H->L
LCD_en = 1;
}
TRISD=0x00;
}
void LCD_command(unsigned char var)
{
LCD_data = var; // Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 0; // Selected command register
LCD_rw = 0; // We are writing in instruction register
LCD_en = 1; // Enable H->L
LCD_en = 0;
LCD_busy(); // Wait for LCD to process the command
}
void LCD_senddata(unsigned char var)
{
LCD_data = var; // Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 1; // Selected data register
LCD_rw = 0; // We are writing in instruction register
LCD_en = 1; // Enable H->L
LCD_en = 0;
LCD_busy(); // Wait for LCD to process the command
}
Added after 22 minutes:
i also checked the voltages of lcd without microocntroller. the readings are same as with microcntroller, sum pins showing 5volts and others at 2.5v and 0v.