Line 11: Line 11:
 
     LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PC_4,PC_5,PC_6,PC_7);
 
     LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PC_4,PC_5,PC_6,PC_7);
 
     LCD_Init(1,16);  
 
     LCD_Init(1,16);  
     LCD_DisplayString("Explore");
+
     LCD_DisplayString("Explore Embedded");
 
     while(1);
 
     while(1);
 
     return (0);
 
     return (0);

Revision as of 13:05, 2 April 2016

Basic

Hookup

Code

LCD 16x1

  1. #include "lcd.h"
  2. int main()
  3. {
  4. /*Connect RS->PB0, RW->PB1, EN->PB2 and data bus to PORTC.4 to PORTC.7*/
  5. LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PC_4,PC_5,PC_6,PC_7);
  6. LCD_Init(1,16);
  7. LCD_DisplayString("Explore Embedded");
  8. while(1);
  9. return (0);
  10. }

LCD 16x2

  1. #include "lcd.h"
  2. int main()
  3. {
  4. /*Connect RS->PB0, RW->PB1, EN->PB2 and data bus to PORTC.4 to PORTC.7*/
  5. LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PC_4,PC_5,PC_6,PC_7);
  6. LCD_Init(2,16);
  7.  
  8. LCD_DisplayString("Explore Embedded");
  9. LCD_DisplayString("Lcd 4-bit Mode");
  10. while(1);
  11.  
  12. return (0);
  13. }

LCD 20x4

  1. #include "lcd.h"
  2. int main()
  3. {
  4. /*Connect RS->PB0, RW->PB1, EN->PB2 and data bus to PORTC.4 to PORTC.7*/
  5. LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PC_4,PC_5,PC_6,PC_7);
  6. LCD_Init(4,20);
  7.  
  8. LCD_DisplayString("Explore Embedded\n");
  9. LCD_DisplayString("LCD 4-bit Mode\n");
  10. LCD_DisplayString("20 x 4 \n");
  11. LCD_DisplayString(":)  :O");
  12.  
  13. while(1);
  14.  
  15. return (0);
  16. }

Demo

The images below shows 16x2, 16x1 and 20x4 LCD's interfaced with starter AVR.
0 lcd2 starter.JPG

Downloads