LCD Interfacing using Atmega 32

Slides:



Advertisements
Similar presentations
Input/Output (I/O) Ports and Interfacing
Advertisements

Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
 | bit OR & bit AND ~ bit NOT ^ bit EXLUSIVE OR (XOR) > bit RIGHT SHIFT.
HD44780 LCD programming From the Hardware Side Design and implementation details on the way to a valid SPI-LCD interface driver.
Intro to AVR ATtiny2313 CS423 Dick Steflik. AVR ATtiny2313.
AVR Programming CS-212 Dick Steflik. ATmega328P I/O for our labs To get data into and out of our Arduino its a little trickier than using printf and.
Embedded Programming and Robotics Lesson 9 Keypad and LCD Display 1.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
16x2 LCD Module on DE2-115 數位電路實驗 TA: 吳柏辰 Author: Trumen.
KyungHee Univ. 2-0 Parallel Port LCD Interface with the HD44780 Controller.
Overview What kind of LCD Interfacing the LCD Displaying Text and Numbers Common Issues.
Digital Outputs LCD Display
Input/Output Ports and Interfacing
1 Lab 1: Introduction. 2 Configure ATMEL AVR Starter Kit 500 (STK500), a prototyping/development board for Lab1. ATmega16 ( V) is the chip used.
LCD Interfacing.
Chapter 10 Glass Bliss Using the Parallel Master Port to communicate with Alphanumeric LCD displays.
Programming Microcontrollers in C Lecture L7.1. C Data Types TypeSizeRange char1 byte-128 – 127 unsigned char1 byte0 – 255 Int2 bytes – unsigned.
Department of Electronic & Electrical Engineering LCD character display (parallel interface). How to interface a LCD character display to a PIC.
ECE 447 Fall 2009 Lecture 12: TI MSP430 External LCD.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
LED AND KEYBOARD INTERFACING PREPARED BY :- PREPARED BY :- RAVAL AKASH ( ) RAVAL AKASH ( ) PATEL HARDIK ( ) PATEL HARDIK.
A.D.Patel institute of technology Sub : LCD and Keyboard interfacing with AVR. prepared by, chokshi abhi p ( ) Guided by, Prof. Asif Thakor.
Interfacing of Input/Output devices with AVR Microcontroller Enrolment No. : Name of the student: SOMAIYA ISHA.
7 SEGMENT INTERFACE WITH AVR MICROCONTROLLER A. D. Patel Institute Of Technology EC :- Sem VPresent By :- Pratik Makadia ( ) 23 June
Sitarambhai Naranjibhai Patel Institute of Technology and Research Centre, Umrakh, Bardoli. A Presentation On “ 16x2 LCD Interfacing with AVR atmega32.
INTERFACING HARDWARE WITH MICROCONTROLLER GUIDED BY: Prof. ASIF SIR 1. AKSHAY KIRAN 2. DEEP PARIKH 3. JIGAR PATEL 4. TILAK PATEL ,05,D2D06,09.
LCD AND LCD INTERFACING. INDEX:-  INTRODUCTION  PIN DISCRIPTION  INITIALIZATION OF LCD  LCD INTERFACING  LCD INTERFACING WITH ATMEGA 32  INTERFACING.
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION
Scrolling LCD using Arduino.
INT. TO EMBEDDED SYSTEMS DEVELOPMENT
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
ARDUINO BASED AUTOMATIC TEMPERATURE BASED FAN SPEED CONTROLLER
Display Devices 16 x 2 lcd display.
4-Integrating Peripherals in Embedded Systems (cont.)
CS4101 Introduction to Embedded Systems Lab 10: Tasks and Scheduling
AVR ATMEGA 8 MICRO-CONTROLLER
LCD and Keyboard Interfacing
UNIVERSAL COLLEGE OF ENGINEERING & TECHNOLOGY
GANDHINAGAR INSTITUTE OF TECHNOLOGY
Liquid Crystal Display Arduino
Interfacing of LCD with µP
OBJECTIVE AND FEATURES:
Chapter 9 Alphanumeric Displays
The Arduino Microcontroller: Atmel AVR Atmega 328
EET 2261 Unit 11 Controlling LCD and Keypad
8051 Programming in C rhussin.
LCD and Keyboard Interfacing
EET 2261 Unit 11 Controlling LCD and Keypad
LCD and Keyboard Interfacing
I/O Ports in AVR Sepehr Naimi
Example 13 The Serial Peripheral Interface (SPI)
Software Environment ISE 5.x Interaction with simple LCDs
AVR Programming in C Chapter 7
AVR Programming in C Chapter 7
Example 7 Liquid Crystal Display
LCD and Keyboard Interfacing
LCD and Keyboard Sepehr Naimi
I/O Ports in AVR Sepehr Naimi
ADC and DAC Programming in AVR
HD44780 LCD programming From the Hardware Side
HD44780 LCD programming From the Hardware Side
8051 Micro Controller.
Intro to Micro Controllers
LCD and Keyboard Interfacing
CTY SAR FCPS Shawn Lupoli, Elliot Tan
LCD (LIQUID CRISTAL DISPLAY) SCREENS
INTERRUPTS.
Presentation transcript:

LCD Interfacing using Atmega 32 Name – himanshu Singh Dept. – ECE Sem – 5th Sub – MCI Enroll no. – 131080111003

Content What is LCD PIN description Programming in LCD Sending commands on LCD Sending Data on LCD Schematic Code for Programming Output on PROTEUS Basic commands used in LCD display

What is LCD LCD stands for Liquid Crystal Display, is an electronic device which is used for data display. LCDs are preferable over seven segments and LEDs as they can easily represent data in form of alphabets, characters , numbers or animations. LCDs are very easy to program and make your work quite attractive and simple. Numerous types of LCDs are available in MARKET         such as 16X2, 16X4, 20X2, 20X4, graphical LCDs (128X64) etc. The LCD which we are using is 16X2 alphanumeric LCD, it display 32 characters in two rows means in one row we have 16 characters.

PIN description of LCD 16X2 LCD can interface with AVR microcontroller by using two modes, 4-bit mode or 8-bit mode. In this article we will use 8-bit mode for interfacing. In 8-bit mode we send command to LCD by using eight data lines (D0-D7) while in 4-bit mode we use four data lines (D5-D7) for sending command and data. These data lines can be connected to any port of Atmega32.

PIN NO. PIN NAME DESCRIPTION 1 VCC Supply pin (+5V DC) 2 VDD Ground pin 3 VEE Contrast pin 4 RS Register selection pin (either data or command)RS=0: Command Register , RS=1: Data Register 5 RW Selects Read or Write operationRW=0: for write RW=1:  for read 6 E Enable pin 7 D0 Data pin 0

8 D1 Data pin 1 9 D2 Data pin 2 10 D3 Data pin 3 11 D4 Data pin 4 12 D5 Data pin 5 13 D6 Data pin 6 14 D7 Data pin 7

Programming of LCD Basically there are two registers, command and data. When we are giving command to LCD, we select command register and when we are sending data to LCD for display, we select data register. Command is an instruction given to LCD in order to perform required function according to the given command. In order to display textual information, data is send to LCD.

Sending commands on LCD For sending commands on LCD we have to write command on data pins. For this, selects: RS = 0 >> selects command register RW = 0 >> selects write operation E >> make enable pin from high to low

Sending data on LCD For sending data on LCD we have to write data on data pins. For this, selects: RS = 1 >> selects data register RW = 0 >> selects write operation E >> make enable pin from high to low

SCHEMATIC

CODE FOR INTERFACING LCD We use Atmel studio 6 for development of code and the code is written in C language. #ifndef F_CPU # define F_CPU 16000000UL // clock speed is 16MHz #endif

#include<avr/io. h> // AVR header #include<util/delay #include<avr/io.h> // AVR header #include<util/delay.h> // delay header //******************LCD PROGRAM STARTS*********************// #define LCD_DATA PORTB // port B is selected as LCD data port #define ctrl PORTD // port D is selected as LCD command port #define en PD7 // enable signal is connected to port D pin 7 #define rw PD6 // read/write signal is connected to port D pin 6 #define rs PD5 // register select signal is connected to port D pin 5

void LCD_cmd(unsigned char cmd); void init_LCD(void); void LCD_write(unsigned char data); int main(void) { DDRB=0xFF; // set LCD data port as output DDRD=0xE0; // set LCD signals (RS, RW, E) as out put init_LCD(); // initialize LCD _delay_ms(100); // delay of 100 Milli seconds

LCD_cmd(0x0C); // display on, cursor off _delay_ms(100); LCD_write(‘ ‘); // call a function to display space on LCD _delay_ms(1);

LCD_write(‘ ‘); // call a function to display space on LCD _delay_ms(1); LCD_write(‘A’); // call a function to display “A” on LCD _delay_ms(100); LCD_write(‘V’); // call a function to display “V” on LCD LCD_write(‘R’); // call a function to display “R” on LCD

LCD_cmd(0xC0); // move cursor to the start of 2nd line _delay_ms(100); LCD_cmd(0x0C); // display on, cursor off LCD_write(‘ ‘); // call a function to display space on LCD _delay_ms(1); LCD_write(‘ ‘);

LCD_write(‘ ‘); _delay_ms(1); LCD_write(‘A’); // call a function to display “A” on LCD _delay_ms(100); LCD_write(‘t’); // call a function to display “t” on LCD LCD_write(‘m’); // call a function to display “m” on LCD LCD_write(‘e’); // call a function to display “e” on LCD

LCD_write(‘g’); // call a function to display “g” on LCD _delay_ms(100); LCD_write(‘a’); // call a function to display “a” on LCD LCD_write(‘3’); // call a function to display “3” on LCD LCD_write(‘2’); // call a function to display “2” on LCD LCD_cmd(0x0E); // make display ON, cursor ON _delay_ms(1);

return 0; } void init_LCD(void) { LCD_cmd(0x38); // initialization in 8bit mode of 16X2 LCD _delay_ms(1); LCD_cmd(0x01); // make clear LCD LCD_cmd(0x02); // return home LCD_cmd(0x06); // make increment in cursor

LCD_cmd(0x80); // “8” go to first line and “0” is for 0th position _delay_ms(1); return; }

//. sending command on LCD //**************sending command on LCD***************// void LCD_cmd(unsigned char cmd) { LCD_DATA = cmd; // data lines are set to send command PORTD &= ~(1<<rs); // RS sets 0 PORTD &= ~(1<<rw); // RW sets 0 PORTD |= (1<<en); // make enable from high to low _delay_ms(100); PORTD &= ~(1<<en); return; }

//*****************write data on LCD*****************// void LCD_write(unsigned char data) { LCD_DATA= data; // data lines are set to send command PORTD |= (1<<rs); // RS sets 1 PORTD &= ~(1<<rw); // RW sets 0 PORTD |= (1<<en); // make enable from high to low _delay_ms(100); PORTD &= ~(1<<en); return ; }

SIMULATION ON PROTEUS

BASIC COMMANDS USED IN LCD DISPLAY DESCRIPTION 0x01 Clear screen 0x02 return home 0x04 Cursor decrement 0x05 Display shifts to right 0x06 Cursor increment 0x07 Display shifts to left 0x08 Cursor and display OFF 0x10 Cursor position Shifts to left 0x14 Cursor position shifts to right

0x38 Using two lines, 8-bit mode 0x28 Using two lines, 4-bit mode 0x80 Move cursor to the beginning of first line 0x0C Display ON, cursor OFF 0XC0 Move cursor to the beginning of second line 0x0A Display OFF, cursor ON 0x0E Display ON, cursor blinking 0x30 For display in one line in 8-bit mode 0x20 For display in one line in 4-bit mode 0x0F Display data on cursor blinking 0x18 Shift complete data to left side 0x1C Shift complete data to right side