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 12:15
Read: times


 
#186353 - Help me
I am interfacing LCD (using ST7066U controller) With MIC, i have written a code in kiel C for AT-89C51,OSC-20MHZ,my code is working in proteus 7.7, but not working in hardware, the LCD is not showing my desired text, its showing nothing. Noted LCD is on by showing a blue light. I am postng the code. PLZ PLZ help me, i am stuck here for a long time.

...insert code here
 


#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 7 messages in thread
TopicAuthorDate
Help me            01/01/70 00:00      
   Descriptive?            01/01/70 00:00      
      Delay            01/01/70 00:00      
         Why loop with char for int parameter?            01/01/70 00:00      
   Tips            01/01/70 00:00      
      Satish, you're not helping yourself here ...            01/01/70 00:00      
         is this the "helping yourself" you refer to?            01/01/70 00:00      

Back to Subject List