SlideShare a Scribd company logo
A.D.Patel institute of technology
 Sub : LCD and Keyboard interfacing with AVR.
prepared by,
chokshi abhi p (130010111001)
Guided by ,
Prof. Asif Thakor .
contents
 Introduction to AVR Board.
 Introduction to LCD .
 Introduction to Keyboard.
 Connection diagram.
 Program.
 Conclusion.
Introduction to AVR Board.
 We have AVR general purpose mother board which is shown in fig 1.1
 It has Microcontroller AVR ATMEGA32 which is very power full controller
with 4 PORTS on board. We can use female header to connect any device with
Board.
 This Board is USBISP compatible that means we can program our IC by using
simple USBASP AVR Programmer, Just Connect ISP pin to the board and
connect to PC with suitable Driver and Program .hex File using any AVR Dude
Gui Programmer.
 This Board has dual Power supply 1)By Adapter 2) By Connecting usbasp.
 This Board has RS232 Port also that means we can Transfer data in full duplex
mode via PC To uC or uC to PC.
 We will connect 2×2 Matrix keyboard to Port B0 1 2 3 and 16×2 LCD to
PORT D.
Mci ppt
Introduction to LCD.
 Here we have 16×2 LCD
 It has 2lines and 16charachters per each line
 LCD has 16 Pin in that
 Pin 1,2,3:It is VSS GND and VCC,Vcc=5V,VSS=GND=0V.
 Pin 4,5,6:It is RS ,R/W and EN
Give Rs=0 for command Register.
Rs=1 for Data register.
R/w=0 For writing data into register
En=Falling edge to enable latch.
 Pin 7-14:Data Pins.
 Pin 15,16:LCD back light.
Mci ppt
Introduction to Keyboard
 As Shown in fig the it is 4by4 matrix keyboard as shown in fig to scan
which key has been pressed first we have to give a 0000 to all raws and
check any key has been pressed by columns by scanning 1 if condition false
then give 20ms debouncing time period and give again 0000 to all raws and
scan whether any key has been pressed.
 To scan all keys follow the below steps
 First make B0pin =0 and B1 pin=1 and scan Pin B2 and B3.
 If pinb2 =0 and pinb3=1 it will be print ‘0’ on screen of LCD.
 If pinb2=1 and pinb3=0 it will be print ‘1’ on screen of LCD.
 Second make B0 pin=1and B1 pin=0 and scan Pin B2 and B3.
 If pinb2 =0 and pinb3=1 it will be print ‘2’ on screen of LCD.
 If pinb2=1 and pinb3=0 it will be print ‘3’ on screen of LCD.
schematic
Inside LCD1.h File
 void lcd_command(unsigned char
z)
{
PORTD=z;
msdelay(1);
PORTB&=~(1<<5);
msdelay(1);
PORTB&=~(1<<6);
msdelay(1);
PORTB|=(1<<7);
msdelay(1);
PORTB&=~(1<<7);
msdelay(1);
}
 void lcd_data(unsigned char m)
{
PORTD=m;
msdelay(1);
PORTB=1;
msdelay(1);
PORTB&=~(1<<6);
msdelay(1);
PORTD|=(1<<7);
msdelay(1);
PORTD&=~(1<<7);
msdelay(1);
}
 void lcd_init(void)
{
DDRD=DDRB=0XFF;
msdelay(1);
lcd_command(0X38);
msdelay(1);
lcd_command(0X0E);
msdelay(1);
lcd_command(0X01);
msdelay(1);
}
 void lcd_string(unsigned char s[])
{
unsigned char i=0,j=0X80,k;
k=strlen(s);
for(i=0;i<k;i++)
{
lcd_command(j);
msdelay(1);
lcd_data(s[i]);
msdelay(1);
j++;
}
return(0);
}
Main Program
 #include<avr/io.h>
#include "lcd1.h"
void check(unsigned char m)
int main()
{
lcd_init();
unsigned char raw;
unsigned char t[2][2]={'0','1',
'2','3'};
while(1)
{
PORTB&=0XFC;
while((PINB&0X0C)==0X0C);
msdelay(20);
while((PINB&0X0C)==0X0C);
raw=0;
PORTB&=~(1<<0);
PORTB|=(1<<1);
check(raw);
raw=1;
PORTB&=~(1<<1);
PORTB|=(1<<0);
check(raw);
}
}
Check function
 void check(unsigned char m)
{
if((PINB&0X0C)==0X08)
{
lcd_command(0X80);
lcd_data(t[m][0]);
}
if((PINB&0X0C)==0X04)
{
lcd_command(0X80);
lcd_data(t[m][1]);
}
}
Conclusion
 From this we have seen that as we press key that corresponding key will
displayed on LCD display as ‘0’ ‘1’ ‘2’ ‘3’ etc.
Thank you

More Related Content

PPTX
Arduino uno lcd display 16x2
DOCX
Lcd interfacing
PDF
Encoder and decoder
PDF
Seven segment display
PDF
L14 kb-lcd-interfacing-with-atmega328 p
PPT
encoder and decoder in digital electronics
PPT
Decodder presentation by ibrar
PPTX
Seven segment display
Arduino uno lcd display 16x2
Lcd interfacing
Encoder and decoder
Seven segment display
L14 kb-lcd-interfacing-with-atmega328 p
encoder and decoder in digital electronics
Decodder presentation by ibrar
Seven segment display

What's hot (20)

PPT
Lcd & keypad
PDF
11111111111
PDF
Decoders and encoders
PPT
Physical prototyping lab1-input_output (2)
PPTX
131080111003 mci
PDF
Arduino Modules
PPTX
Smart home arduino
PPTX
Key board interfacing with 8051
PPTX
Bcd to 7 segment display
PPTX
Seven Segment Decoders
PPT
RF Encoder / Decoder Chipset
PPTX
LCD interfacing
PPTX
Robotics Session day 1
PPTX
Lcd interfacing with microprocessor 8051
DOC
22 microcontroller programs
DOCX
Report no.3(microprocessor)
PPTX
decorder and encoder and its applications
DOCX
Basic standard calculator
PPT
Physical prototyping lab3-serious_serial
DOCX
Types of encoders and decoders with truth tables
Lcd & keypad
11111111111
Decoders and encoders
Physical prototyping lab1-input_output (2)
131080111003 mci
Arduino Modules
Smart home arduino
Key board interfacing with 8051
Bcd to 7 segment display
Seven Segment Decoders
RF Encoder / Decoder Chipset
LCD interfacing
Robotics Session day 1
Lcd interfacing with microprocessor 8051
22 microcontroller programs
Report no.3(microprocessor)
decorder and encoder and its applications
Basic standard calculator
Physical prototyping lab3-serious_serial
Types of encoders and decoders with truth tables
Ad

Viewers also liked (10)

PPTX
Capitulo 8 control interno
PPTX
Control interno
PPTX
Mci updated ppt
PPTX
Procedimientos y técnicas de auditoria, control interno de examenes a las exi...
PPTX
Control interno
PPTX
Sistema de control interno
PPTX
Presentación control interno
PPTX
Control interno
PPT
Control interno power point
PPTX
Sistemas de control interno
Capitulo 8 control interno
Control interno
Mci updated ppt
Procedimientos y técnicas de auditoria, control interno de examenes a las exi...
Control interno
Sistema de control interno
Presentación control interno
Control interno
Control interno power point
Sistemas de control interno
Ad

Similar to Mci ppt (20)

PPTX
Micro c lab6(lcd)
DOC
Ps2 keyboard read display system
PDF
Arduino based applications part 2
PDF
Arduino frequency counter
PDF
Microcontroladores: El microcontrolador 8051 con LCD 16x2
PDF
ATTiny Light Sculpture Project - Part I (Setup)
PDF
Display Characters of a String one by One on a 7 Segment Display
DOCX
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
DOCX
Project_report_on_Attendance_system
PDF
Hd44780a00 dtasheet
DOCX
Keypad interfacing 8051 -NANOCDAC
PDF
Embedded system course projects - Arduino Course
PDF
Embedded C Programming Module 7 Presentation
PPTX
LCD (2).pptx
PPTX
Fund. of IoT LAB - CO 252.pptx
PDF
Display a Character on a 7 Segment Display
PPT
Lcd interfacing1
PDF
AVR_Course_Day5 avr interfaces
PPTX
Arduino Workshop (3).pptx
PDF
Switch Control and Time Delay - Keypad
Micro c lab6(lcd)
Ps2 keyboard read display system
Arduino based applications part 2
Arduino frequency counter
Microcontroladores: El microcontrolador 8051 con LCD 16x2
ATTiny Light Sculpture Project - Part I (Setup)
Display Characters of a String one by One on a 7 Segment Display
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
Project_report_on_Attendance_system
Hd44780a00 dtasheet
Keypad interfacing 8051 -NANOCDAC
Embedded system course projects - Arduino Course
Embedded C Programming Module 7 Presentation
LCD (2).pptx
Fund. of IoT LAB - CO 252.pptx
Display a Character on a 7 Segment Display
Lcd interfacing1
AVR_Course_Day5 avr interfaces
Arduino Workshop (3).pptx
Switch Control and Time Delay - Keypad

More from Kushagra Ganeriwal (12)

PPTX
Fm generation
PPTX
7 segment interface with avr microcontroller
PPTX
History of computer crime
PPTX
Conductors
PPT
Coulomb's law and its applications
PPTX
PPTX
Interfacing ultrasonic rangefinder with avr mc us
DOCX
electronic mixer
DOCX
auditorium
DOCX
Prac3 LOUDSPEAKER
Fm generation
7 segment interface with avr microcontroller
History of computer crime
Conductors
Coulomb's law and its applications
Interfacing ultrasonic rangefinder with avr mc us
electronic mixer
auditorium
Prac3 LOUDSPEAKER

Recently uploaded (20)

PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Digital Logic Computer Design lecture notes
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Well-logging-methods_new................
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Model Code of Practice - Construction Work - 21102022 .pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Digital Logic Computer Design lecture notes
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Mechanical Engineering MATERIALS Selection
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Foundation to blockchain - A guide to Blockchain Tech
Well-logging-methods_new................
bas. eng. economics group 4 presentation 1.pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx

Mci ppt

  • 1. A.D.Patel institute of technology  Sub : LCD and Keyboard interfacing with AVR. prepared by, chokshi abhi p (130010111001) Guided by , Prof. Asif Thakor .
  • 2. contents  Introduction to AVR Board.  Introduction to LCD .  Introduction to Keyboard.  Connection diagram.  Program.  Conclusion.
  • 3. Introduction to AVR Board.  We have AVR general purpose mother board which is shown in fig 1.1  It has Microcontroller AVR ATMEGA32 which is very power full controller with 4 PORTS on board. We can use female header to connect any device with Board.  This Board is USBISP compatible that means we can program our IC by using simple USBASP AVR Programmer, Just Connect ISP pin to the board and connect to PC with suitable Driver and Program .hex File using any AVR Dude Gui Programmer.  This Board has dual Power supply 1)By Adapter 2) By Connecting usbasp.  This Board has RS232 Port also that means we can Transfer data in full duplex mode via PC To uC or uC to PC.  We will connect 2×2 Matrix keyboard to Port B0 1 2 3 and 16×2 LCD to PORT D.
  • 5. Introduction to LCD.  Here we have 16×2 LCD  It has 2lines and 16charachters per each line  LCD has 16 Pin in that  Pin 1,2,3:It is VSS GND and VCC,Vcc=5V,VSS=GND=0V.  Pin 4,5,6:It is RS ,R/W and EN Give Rs=0 for command Register. Rs=1 for Data register. R/w=0 For writing data into register En=Falling edge to enable latch.  Pin 7-14:Data Pins.  Pin 15,16:LCD back light.
  • 8.  As Shown in fig the it is 4by4 matrix keyboard as shown in fig to scan which key has been pressed first we have to give a 0000 to all raws and check any key has been pressed by columns by scanning 1 if condition false then give 20ms debouncing time period and give again 0000 to all raws and scan whether any key has been pressed.  To scan all keys follow the below steps  First make B0pin =0 and B1 pin=1 and scan Pin B2 and B3.  If pinb2 =0 and pinb3=1 it will be print ‘0’ on screen of LCD.  If pinb2=1 and pinb3=0 it will be print ‘1’ on screen of LCD.  Second make B0 pin=1and B1 pin=0 and scan Pin B2 and B3.  If pinb2 =0 and pinb3=1 it will be print ‘2’ on screen of LCD.  If pinb2=1 and pinb3=0 it will be print ‘3’ on screen of LCD.
  • 10. Inside LCD1.h File  void lcd_command(unsigned char z) { PORTD=z; msdelay(1); PORTB&=~(1<<5); msdelay(1); PORTB&=~(1<<6); msdelay(1); PORTB|=(1<<7); msdelay(1); PORTB&=~(1<<7); msdelay(1); }  void lcd_data(unsigned char m) { PORTD=m; msdelay(1); PORTB=1; msdelay(1); PORTB&=~(1<<6); msdelay(1); PORTD|=(1<<7); msdelay(1); PORTD&=~(1<<7); msdelay(1); }
  • 11.  void lcd_init(void) { DDRD=DDRB=0XFF; msdelay(1); lcd_command(0X38); msdelay(1); lcd_command(0X0E); msdelay(1); lcd_command(0X01); msdelay(1); }  void lcd_string(unsigned char s[]) { unsigned char i=0,j=0X80,k; k=strlen(s); for(i=0;i<k;i++) { lcd_command(j); msdelay(1); lcd_data(s[i]); msdelay(1); j++; } return(0); }
  • 12. Main Program  #include<avr/io.h> #include "lcd1.h" void check(unsigned char m) int main() { lcd_init(); unsigned char raw; unsigned char t[2][2]={'0','1', '2','3'}; while(1) { PORTB&=0XFC; while((PINB&0X0C)==0X0C); msdelay(20); while((PINB&0X0C)==0X0C); raw=0; PORTB&=~(1<<0); PORTB|=(1<<1); check(raw); raw=1; PORTB&=~(1<<1); PORTB|=(1<<0); check(raw); } }
  • 13. Check function  void check(unsigned char m) { if((PINB&0X0C)==0X08) { lcd_command(0X80); lcd_data(t[m][0]); } if((PINB&0X0C)==0X04) { lcd_command(0X80); lcd_data(t[m][1]); } }
  • 14. Conclusion  From this we have seen that as we press key that corresponding key will displayed on LCD display as ‘0’ ‘1’ ‘2’ ‘3’ etc.