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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/24/06 01:58
Read: times


 
Msg Score: +2
 +2 Good Answer/Helpful
#122864 - Houston, we have a problem
Responding to: ???'s previous message
Firstly, look at your Lcd_init routine against what the HD44780 datasheet suggests for 4bit initialisation. I'm sure you'll find some discrepancy here.

Also, your code violates the data setup time for the HD44780. You data must be valid before setting EN. Don't set EN then output your data. I've moved the lines in your routine.
void Lcd_Cmd (unsigned char Cmd)
{	
	Rs = 0;
	Rw = 0;
	Lcd = (Cmd & 0xf0) >> 4;		//Write high nibble
	En = 1;
	En = 0;
	Lcd = (Cmd & 0x0f);			//Write low nibble

	En = 1;
	En = 0;
	Delay_uS (50); 				//Delay 50us
}


Here's something I did earlier that might give some hints. read in conjuction with the hd44780 datasheet for the explanation.
void lcd_init(void)
{
   delay_100u(50);
   LCD_PORT = 0xc0;
   delay_100u(25);
   LCD_PORT = 0xc3;
   NOP();
   NOP();
   LCD_DEN = 1;
   NOP();
   NOP();
   LCD_DEN = 0;

   delay_100u(50);
   
   LCD_PORT = 0xc3;
   NOP();
   NOP();
   LCD_DEN = 1;
   NOP();
   NOP();
   LCD_DEN = 0;

   delay_100u(50);
   
   LCD_PORT = 0xc3;
   NOP();
   NOP();
   LCD_DEN = 1;
   NOP();
   NOP();
   LCD_DEN = 0;

   delay_100u(25);
   
   LCD_PORT = 0xc2;
   NOP();
   NOP();
   LCD_DEN = 1;
   NOP();
   NOP();
   LCD_DEN = 0;

   delay_100u(25);
   
   lcd_comm_wr(0x2c);
   delay_100u(100);

   lcd_comm_wr(0x0c);
   delay_100u(100);

   lcd_comm_wr(0x06);
   delay_100u(100);

   lcd_comm_wr(0x01);
   
   delay_100u(50);
}
 


Don't worry, you're only the 10,000,000th person to have problems with these things....

List of 5 messages in thread
TopicAuthorDate
Something is not right            01/01/70 00:00      
               01/01/70 00:00      
   Houston, we have a problem            01/01/70 00:00      
      Something is not right            01/01/70 00:00      
   Problem solved            01/01/70 00:00      

Back to Subject List