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 05:15
Read: 647 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      Daud Shakil      03/02/12 05:15      
   Descriptive?      Per Westermark      03/02/12 05:54      
      Delay      Per Westermark      03/02/12 06:02      
         Why loop with char for int parameter?      Per Westermark      03/02/12 06:08      
   Tips      Satish S Munot      03/02/12 05:57      
      Satish, you're not helping yourself here ...      Richard Erlacher      03/02/12 07:02      
         is this the "helping yourself" you refer to?      Erik Malund      03/02/12 07:36      

Back to Subject List