Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/02/12 22:48
Read: 753 times


 
Msg Score: -1
 -1 Didn't Search First
#186372 - hep me PLZ
i am interfacing LCD which has a ST7066U LCD driver, With AT-89S51, OSC-20mHZ, my code is working in proteus 7.7 but not working in hardware, PLZ HElp me






program code:
#define count 1700 // for 1 ms(approximate)
#include <REGX51.H>
sbit RS=P1^0;
sbit RW=P1^1;
sbit EN=P1^2;
//***********************************//
void delay(unsigned int ms); // for Lcd delay
void enable(); // for strobe control
void command(unsigned char cmd_code); // for instruction
void Lcd_string(unsigned char *text); // for writting a string
void Lcd_int(); // for Lcd initialization
//***********************************//

void main()
{
delay(50);
while(1)
{
Lcd_int();
Lcd_string("ALMIGHTY ALLAH");
delay(200);
}
}
//***********************************//

void delay(unsigned int ms)
{
unsigned char n;
unsigned int i;
for(n=0;n<ms;n++)
{
for(i=0;i<count;i++)
;
}
}
//************************************//

void enable()
{
EN=1;
delay(1);
EN=0;
delay(2);
}
//************************************//
void command(unsigned char cmd_code)
{
P2=cmd_code;
enable();
}
//************************************//
void Lcd_int()
{
RS=0; // for instruction data
RW=0; // for write operation
EN=0; // enable is low
command(0x30); // mode 8 bit, 1 line display,font 5x8
command(0x30);
command(0x0F); // entire display on,cursor on,blinking on
command(0x02); // return cursor to origin
command(0x01); // clear display
command(0x06); // entry mode is set
}
//************************************//
void Lcd_string(unsigned char *text)
{
RS=1;
RW=0;
while(*text!='')
{
P2=*text++; // for outputing a single byte at a time
enable();
}
}
//************************************//




List of 4 messages in thread
TopicAuthorDate
hep me PLZ      Daud Shakil      03/02/12 22:48      
   2 Threads?      Neil Kurzman      03/02/12 23:12      
   Duplicate Thread      Andy Neil      03/03/12 06:15      
   i saw this one an will stick with it      Erik Malund      03/03/12 07:16      

Back to Subject List