jannogale
Newbie level 4
the problem that i faced in this programm is that the letter B not appearing on LCD.
I need a help plz.
#define LCD_rs P2_4
#define LCD_rw P2_5
#define LCD_e P2_6
#define LCD_data P2
void main (void)
{
void delay(void);
void LCD_init (void);
void LCD_Control(unsigned char);
void LCD_Data(unsigned char d);
LCD_init();
LCD_Data('B');
while(1)
{
LCD_Data('B');
}
void LCD_init (void)
{
LCD_Control(0x03);
LCD_Control(0x03);
LCD_Control(0x03);
LCD_Control(0x02);
LCD_Control(0x28);
}
void delay(void)
{
int i = 0;
for (i = 0; i < 1000; i++);
}
void LCD_Data(unsigned char d)
{
unsigned char Hbyte;
unsigned char Lbyte;
Lbyte = d & 0xf0;
Hbyte = (d >> 4) & 0x0f;
P2 = 0;
P2 = P2 | Hbyte;
P2 = P2 | 0x50; //E = 1
delay();
P2 = P2 & ~0x50; // E = 0
delay();
P2 = P2 | Lbyte;
P2 = P2 | 0x50;
delay();
P2 = P2 & ~0x50;
delay();
P2 = 0;
}
void LCD_Control(unsigned char d)
{
unsigned char Hbyte;
unsigned char Lbyte;
Lbyte = d & 0xf0;
Hbyte = (d >> 4) & 0x0f;
P2 = 0;
P2 = P2 | Hbyte;
P2 = P2 | 0x40; // E = 1
delay();
P2 = P2 & ~0x40; // E = 0
delay();
P2 = P2 | Lbyte;
P2 = P2 | 0x40;
delay();
P2 = P2 & ~0x40;
delay();
P2 = 0;
}
} End of Main
I need a help plz.
#define LCD_rs P2_4
#define LCD_rw P2_5
#define LCD_e P2_6
#define LCD_data P2
void main (void)
{
void delay(void);
void LCD_init (void);
void LCD_Control(unsigned char);
void LCD_Data(unsigned char d);
LCD_init();
LCD_Data('B');
while(1)
{
LCD_Data('B');
}
void LCD_init (void)
{
LCD_Control(0x03);
LCD_Control(0x03);
LCD_Control(0x03);
LCD_Control(0x02);
LCD_Control(0x28);
}
void delay(void)
{
int i = 0;
for (i = 0; i < 1000; i++);
}
void LCD_Data(unsigned char d)
{
unsigned char Hbyte;
unsigned char Lbyte;
Lbyte = d & 0xf0;
Hbyte = (d >> 4) & 0x0f;
P2 = 0;
P2 = P2 | Hbyte;
P2 = P2 | 0x50; //E = 1
delay();
P2 = P2 & ~0x50; // E = 0
delay();
P2 = P2 | Lbyte;
P2 = P2 | 0x50;
delay();
P2 = P2 & ~0x50;
delay();
P2 = 0;
}
void LCD_Control(unsigned char d)
{
unsigned char Hbyte;
unsigned char Lbyte;
Lbyte = d & 0xf0;
Hbyte = (d >> 4) & 0x0f;
P2 = 0;
P2 = P2 | Hbyte;
P2 = P2 | 0x40; // E = 1
delay();
P2 = P2 & ~0x40; // E = 0
delay();
P2 = P2 | Lbyte;
P2 = P2 | 0x40;
delay();
P2 = P2 & ~0x40;
delay();
P2 = 0;
}
} End of Main