






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!







Components Quantity
led.c:
op_char:
void op_char (char value) { PORTD = 0x40; // only E is high PORTA = value; PORTD = 0x00; // E is low _delay_ms(DELAY); } initiallize:
o DL - Set Data Interface Length : 8(1) (for 8-bt mode) o N - Number of Display Lines : 2(1) (for 2-lines) o F - Character Font: 5x10(1)
// 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 }
write:
_void write (char value) { // To Write a character to the display PORTD = 0x60; // E and RS both are high PORTA = value; PORTD = 0x20; // E is low delay_us(DELAY); }
Code: final.prj: .MICRO "ATmega16"
.TOOLCHAIN "GCC" .GCCPATH "D:\WinAVR‐20080430"
.GCCMAKE AUTO .TARGET "final.hex" .SOURCE "final.c"
.TRACE ; Activate micro trace .POWER VDD=5 VSS=0 ; Power nodes
.CLOCK 1meg ; Micro clock .STORE 250m ; Trace (micro+signals) storage time
;X[inst_name] LCD(chars lines oscil_freq) RS RW E D7 D6 D5 D4 D3 D2 D1 D X1 LCD(16 2 250k) PD5 PD4 PD6 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA
final.c: // *********************************************************** // Project: LCD Interfacing
// Author: Group # 9 // Module description: Implementing LCD interfacing using HD44780 type // ***********************************************************
#include
#include
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 Definitions //
// Initializing the LCD
// =========================================================== void initiallize (void)
{ //STEP 1 _delay_ms(16); // to give delay of more than 15msec (roughly)
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;