Re: how to write busy flag?
#include<at89s53.h>
#define EN P0_1
#define RW P0_2
#define RS P0_7
#define SW P0_6
#define clearLCD 0x01
void Delay(unsigned int Duration)
{
while((Duration--)!=0)
{
unsigned int loop=1000;
while((loop--)!=0);
}
}
void strobe()
// Generate the E signal
{
EN = 1;
Delay(5);
EN = 0;
Delay(5);
}
void LCD_control(unsigned char controlCode) // Control position of characters which is going to be displayed.
{
P2=controlCode;
RS=0;
RW=0;
strobe();
}
void LCD_CMD_Write(unsigned char Command)
{
EN=0;
P2=Command;
RS=0;
RW=0;
EN=1;
Delay(5);
EN=0;
Delay(5);
}
void LCD_DATA_Write(unsigned char Data)
{
EN=0;
P2=Data;
RS=1;
RW=0;
EN=1;
Delay(5);
EN=0;
Delay(5);
}
void main()
{
unsigned char x,y;
LCD_CMD_Write(0x38); //8-bit, 2-line display, 5x7 font
LCD_CMD_Write(0x06); //auto increment
LCD_CMD_Write(0x0E); //display on, cursor on, no blinking
LCD_CMD_Write(clearLCD); //clear display, reset
while(1){
LCD_CMD_Write(clearLCD); //clear display, reset
for(x=0x41;x<0x5B;x++)
{
LCD_CMD_Write(0x0e);
LCD_control(0xcf);
LCD_DATA_Write(x);
Delay(5);
}
for(y=0x31;y<0x3a;y++)
{
LCD_CMD_Write(0x0e);
LCD_control(0x80);
LCD_DATA_Write
;
Delay(5);
}
}
}
somewhere in between the program to replace the delay function.
to make it program more efficient n fast..
thanks for ur kind reply..