

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


// Project: LCD Interfacing // Author: Group # 9 // Module description: Implementing LCD interfacing using HD44780 type // ***********************************************************
#include // Most basic include files #include // here #include #include
// *********************************************************** // Function Prototypes //
void op_char (char); void initiallize (void); void write (char);
// *********************************************************** // Main program // int main(void) { DDRA = 0xFF; // To enable output on pins of PORTA DDRD = 0x70; // To enable output on pins PD4 PD5 PD initiallize();
char text1[] = {"Bismillah"}; char text2[] = {"Welcome"};
op_char (0x0E); // To Turn on the display
while(1) { unsigned int i=0; op_char (0x80); // To Position the cursor back on 1st line in each loop
while(text1[i] !='\0') { write (text1[i]); i++; }
op_char(0xC0); // To move on to the next line
i = 0; while(text2[i] !='\0') { write (text2[i]);
i++; } } }
// Functions Definations //
// Initializing the LCD // =========================================================== void initiallize (void) { //STEP 1 _delay_ms(16); // to give delay of more than 15msec (roughly)
//STEP 2 op_char(0x30);
//STEP 3 op_char(0x30);
//STEP 4 op_char(0x30);
//STEP 5 // Part 1: op_char(0x3C); // To set interface length
// Part 2: op_char (0x08); // To turn off the display
// Part 3: op_char (0x01); // To clear the display
// Part 4: op_char (0x07); //Set cursor move direction
// Part 5: op_char (0x0E); //TO enable display or cursor }
// Operating Characteristics // =========================================================== void op_char (char value) { PORTD = 0x40; // only E is high PORTA = value; PORTD = 0x00; // E is low _delay_ms(DELAY); }