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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/03/05 14:22
Read: times


 
#100536 - i had but its not working
Responding to: ???'s previous message
i have seen all that stuff , but iam unable to work out with it

can anyone please write the code for initializing a 16 x 1 lcd module for atmel 89s8252 microcontroller.
check this

/****************** lcd initialization **************************/

/* lcd initialistion*/
void LCD_init(void)
{
LCD_write(0,0x30);
LCD_write(0,0x0F);
LCD_write(0,0x06);
LCD_write(0,0x01);
LCD_write(0,0x00);
}

void LCD_write(unsigned char data_ctrl, unsigned char LCD_data)
{
LCD_RS = data_ctrl;
LCD_RW = 0;
LCD_EN = 0;
P2 = LCD_data;
small_delay();
LCD_EN = 1;
}

/************************ function for writing to lcd ends *************/
void big_delay(void)
{
unsigned int a;
a = 50000;
while(a)
a--;
}

void small_delay(void)
{
unsigned int b;
b = 250;
while(b)
b--;
}
void main(void)
{
unsigned char value; /** value for enter key***/
unsigned char vald; /** vald for down key ****/
unsigned char valup; /** valup for up key *****/

LCD_init();
LCD_write(1,'D');
LCD_write(1,'A');
LCD_write(1,'T');
LCD_write(1,'A');
LCD_write(1,'L');
LCD_write(1,'O');
LCD_write(1,'G');
big_delay();

LCD_init();
LCD_write(1,'C');
LCD_write(1,'O');
LCD_write(1,'N');
LCD_write(1,'T');
LCD_write(1,'R');
LCD_write(1,'O');
LCD_write(1,'L');
LCD_write(1,'S');
big_delay();
keypad();
}





i have written this code it does contain any errors and is compiled but when i dump this onto the controller , i get some irrelavent data on the screen of lcd. i have the define .h file where i have defined LCD_RS etc.

can u help me out.
please correct it.




List of 5 messages in thread
TopicAuthorDate
lcd_init() function            01/01/70 00:00      
   open it:)            01/01/70 00:00      
   i had but its not working            01/01/70 00:00      
      So debug it!            01/01/70 00:00      
   8-bit or 4-bit?            01/01/70 00:00      

Back to Subject List