Introduction
of lcd and interfacing
Lcd(liquid crystal display):-
Series for embedded is
16x1 means 1 row 16 columns
16x2
means 2 row 16 columns
16x4
means 4 row 16 columns
20x1
means 1 row 20 columns
20x2
means 2 row 20 columns
40x1
means 1 row 40 columns
40x2
means 2 row 40 columns
· Lcd
is a individually an embedded product. It is preceed 8-bit data at a time.
· It
has 8 select data line by this 8-bit data is transferred at a time.
· In
this 16 pin in which 15 and 16 pin is provide lcd backlight. Pin 1 and 2
provides power to lcd and 3rd pin vee stands for variable resistance
this is used for control the contrast of lcd.
· Lcd
have 2 registers
1. Command register
2. Data
register
Both
registers are 8-bit.
Pin 4, 5 and 6 are RS, RW and EN
RS-
Register select
Send 0 for command
Send 1 for data.
RW-
READ WRITE
Send 1 for read
Send 0 for write
EN-
ENABLE
send 1 for command
send 1 for data.
after giving delay enable will be zero.
LCD has some predefined commands:-
· 0x01 for clear display screen.
· 0x04
for decrement cursor.
· 0x06 for increment cursor.
· 0x80 force cursor to the beginning
of first line.
· 0xc0
force cursor to the beginning of second line.
· 0x90
force cursor to the beginning of third line.
· 0xdo
force cursor to the beginning of fourth line.
· 0x0e for display on cursor
blinking.
· 0x0f
for display on cursor not blinking.
· 0x02
for select 4 bit mode.
· 0x28
selects 5x7 matrix for 4 bit mode.
· 0x38 selects 5x7 matrix for 8 bit
mode.
· 0x18
fir moving entire display left.
· 0x1c
for moving entire display right.
We are using commonly
these bold commands.
program to display A on LCD screen.
#include<avr/io.h>
#include<util/delay.h>
void cmd()
{
PORTA=0B00000100;
_delay_ms(300);
PORTA=0b00000000;
}
void display()
{
PORTA=0b00000101;
_delay_ms(300);
PORTA=0b00000001;
}
void main()
{
DDRA=0xff;
DDRB=0xff;
PORTB=0X38;
cmd();
PORTB=0X0e;
cmd();
PORTB=0X01;
cmd();
PORTB=0X80;
cmd();
PORTB=0X06;
cmd();
PORTB='A';
display();
}
No comments:
Post a Comment