Vignya
Newbie level 4
Hi guys,
Can anyone give me code in C to check busy flag of LCD in 4 bit mode. My LCD code is working fine with delays but I want to do it with busy flag but dont know how to do it?
void set_D7_input(void)
{
P0M1=0x80;P0M2=0x7F; // i/p only
}
//=============================================================
void set_D7_output(void)
{
P0M1=0x00;P0M2=0xFF; // output only
}
//======================================
void LCD_busy()
{
set_D7_input(); //Make D7th bit of LCD as i/p
LCD_RS = 0; //Selected command register
LCD_RW = 1; //We are reading
while(LCD_D7){ //read busy flag again and again till it becomes 0
LCD_E = 0; //Enable H->L
us10_delay(1);
LCD_E = 1;
}
LCD_E = 0;
set_D7_output();
}
I tried to do it with just reading D7 bit but didn't worked. Is I hv to read the whole byte & then check D7?
Can anyone give me code in C to check busy flag of LCD in 4 bit mode. My LCD code is working fine with delays but I want to do it with busy flag but dont know how to do it?
void set_D7_input(void)
{
P0M1=0x80;P0M2=0x7F; // i/p only
}
//=============================================================
void set_D7_output(void)
{
P0M1=0x00;P0M2=0xFF; // output only
}
//======================================
void LCD_busy()
{
set_D7_input(); //Make D7th bit of LCD as i/p
LCD_RS = 0; //Selected command register
LCD_RW = 1; //We are reading
while(LCD_D7){ //read busy flag again and again till it becomes 0
LCD_E = 0; //Enable H->L
us10_delay(1);
LCD_E = 1;
}
LCD_E = 0;
set_D7_output();
}
I tried to do it with just reading D7 bit but didn't worked. Is I hv to read the whole byte & then check D7?
Last edited: