LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of...
-
Upload
meghan-payne -
Category
Documents
-
view
221 -
download
0
Transcript of LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of...
![Page 1: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/1.jpg)
LCD INTERFACING
![Page 2: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/2.jpg)
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits.
16 Characters x 2 LinesBuilt-in HD44780 Equivalent LCD Controller
Introduction to LCD
![Page 3: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/3.jpg)
Liquid Crystal Display (LCD)
PINS
![Page 4: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/4.jpg)
Pin
Con
fig
ura
tion
![Page 5: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/5.jpg)
Fixed voltage pins: Pin1 (Vss/Gnd), Pin2(Vcc), Pin3(Vee, connected to a port) are dc lines, they are directly connected to voltage sources and to ground, they are not controlled by the microcontroller. Control Pins: Pin4(RS), Pin(R/W), Pin6(EN) are control pins Backlight Control Pins: There are two extra pins (LED+ and LED-) to turn on the backlight of LCD display.
Data Pins:
Pin7 to Pin14 are data pins.
![Page 6: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/6.jpg)
CONTROL PINS
RS is the register select pin. To write display data to the LCD (characters), this pin has to be high. For commands his pin needs to be low.
R/W is the data direction pin. For WRITING data TO the LCD it has to be low, for READING data FROM the LCD it has to be high.
E is the Enable pin. When writing data to the LCD, the LCD will read the data on the falling edge of E
![Page 7: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/7.jpg)
LCD use in 4 bit mode & Masking
The Data or command is sent in nibble form (1 nibble= 4 bit) in the 4-bit mode. The higher nibble is sent first followed by the lower nibble. The function of RS, RW and EN pins remains similar to 8-bit mode.
Higher pins of PORTX (PX4-PX7) are connected to data line. So, the higher nibble of a byte can be sent to LCD data lines by masking lower nibble. To send lower nibble, data byte is shifted left for four places. Lower nibble replaces higher nibble by this shifting. Data is sent after masking the byte. Example: if data is 0011 0010 0x32; 0010 0000 0x20(Masking) 1111 0000 0xF0 resultant data is sent to LCD
![Page 8: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/8.jpg)
Save the new file with .c extension
![Page 9: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/9.jpg)
Open Make File from start->programs-> winavr
![Page 10: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/10.jpg)
Enable Editing MakeFile
(last option from drop down menu)
![Page 11: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/11.jpg)
Click MakeFile (from menu) -> main file name -> give the same name as above without .c extension. As for the above example name it as LCD -> Click OK
Now scroll a little above to the section F_CPU = 8000000 -> Make the desired change be editing it. If you are using a 16MHz crystal then F_CPU should be equal to 16000000.
![Page 12: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/12.jpg)
![Page 13: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/13.jpg)
Click MakeFile (from menu) -> MCU type -> ATmega -> atmega16 (If you are using ATmega16).
Click MakeFile (from menu) -> Port -> USB (if you are using a usb type of programmer) else choose the COM port where you have connected the programmer.
Scroll to the section AVRDUDE_PROGRAMMER = stk500v2. Change stk500v2 by usbasp(or usbtiny) if you are using a USBasp programmer. It is the most commonly used programmer. Hence it looks like AVRDUDE_PROGRAMMER = usbasp (or usbtiny)
![Page 14: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/14.jpg)
![Page 15: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/15.jpg)
Click MakeFile (from menu) -> Programmer (if you are NOT using a USBasp programmer) and choose your programmer.
Now the last step -> file -> save as -> browse to the folder where you have saved the file led.c (Desktop/AVR/led_blink) then save it. Make sure the file name is not changed, it should be named as Makefile
Now you are all done to write your code in programmer’s notepad and compile it and even burn it to your MCU with the help of WinAVR.
![Page 16: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/16.jpg)
PROTEUS SIMULATION
![Page 17: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/17.jpg)
Click here
![Page 18: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/18.jpg)
Write name and path of new project
![Page 19: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/19.jpg)
Create DEFAULT
Schematic capture
![Page 20: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/20.jpg)
![Page 21: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/21.jpg)
![Page 22: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/22.jpg)
New ProjectZoom IN/OUT
Click on “P” to pick components
Power/Ground
Click to run simulation
![Page 23: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/23.jpg)
Search Box
Select Atmega 16
Click Ok
![Page 24: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/24.jpg)
In similar manner we can select other devices
![Page 25: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/25.jpg)
Select 16*2 alphanumeric LCD
![Page 26: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/26.jpg)
![Page 27: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/27.jpg)
LCD functions for Win AVR
LCDInit(uint8_t style);
LCDWriteString(‘msg’);
LCDWriteInt(int val,unsigned int field_length);
LCDGotoXY(uint8_t x,uint8_t y);
LCDClear()
LCDData(‘w’)
![Page 28: LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and.](https://reader035.fdocument.pub/reader035/viewer/2022062309/56649ed05503460f94bdf26a/html5/thumbnails/28.jpg)
#include <avr/io.h>#include <util/delay.h>#include "lcd.h"#include "lcd.c"#include "custom_char.h"
void main(){DDRC=0xff;LCDInit(LS_BLINK);while(1){LCDGotoXY(5,0);LCDWriteString("ZAINAB");LCDGotoXY(4,1);LCDWriteInt(123);}}
LCD in WINAVR