INTERFACING KEYBOARD WITH ATMEGA32 ELECTRONICS & COMMUNICATION TITLE.

Slides:



Advertisements
Similar presentations
Introduction to Micro-controllers Anurag Dwivedi.
Advertisements

Programmable Interval Timer
Programmable Keyboard/ Display Interface: 8279
MICRO-CONTROLLER: A microcontroller is the brain of the robot: These are: 1. Integrated Circuits (ICs) 2. Programmable.
EE 316 Computer Engineering Junior Lab Word Mastermind.
EE 316 Computer Engineering Junior Lab PS/2 Keyboard.
Other I/O LCD display Flash ROM Keyboard (PS/2) UART connectors.
1 COMP541 Keyboard Interface Montek Singh April 9, 2007.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
COMP541 Input Devices: Keyboards, Mice and Joysticks
EE 316 Computer Engineering Junior Lab Digital Hangman.
Practical Session No. 10 Input &Output (I/O). I/O Devices Input/output (I/O) devices provide the means to interact with the “outside world”. An I/O device.
ECE 371- Unit 11 Introduction to Serial I/O. TWO MAJOR CLASSES OF SERIAL DATA INTERFACES ASYNCHRONOUS SERIAL I/O - USES “FRAMING BITS” (START BIT AND.
University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi.
CHAPTER 10 Keyboard and Printer Interfacing. Matrix Keyboard.
1 COMP541 Input Devices: Keyboards, Mice and Joysticks Montek Singh Apr 16, 2012.
Objectives How Microcontroller works
UNIT 8 Keypad Interface Contact Closure Counter Exceptions (Interrupts and Reset)
Universal Asynchronous Receiver/Transmitter (UART)
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
Digital Inputs Interfacing Keypad
1 COMP541 Input Devices: Keyboards, Mice and Joysticks Montek Singh Apr 6, 2015.
Interrupts Microprocessor and Interfacing
PS/2 Mouse/Keyboard Port
KEYBOARD INTERFACING Keyboards are organized in a matrix of rows and columns The CPU accesses both rows and columns through ports. ƒTherefore, with two.
Alpha/Numeric Keypad Functions using AVR Preliminary Design Review Luke R. Morgan ECE /17/2008.
Keyboard Introduction Keyboard is an input device. It is used to give text, numbers and controls as input to computer. The.
ECE 447: Lecture 12 Keypads ECE 447: Lecture 10. ECE 447: Matrix Keypad.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
Networked Embedded Systems Pengyu Zhang EE107 Spring 2016 Lecture 8 Serial Buses.
8251 USART.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Assist. Prof. Rassim Suliyev - SDU 2017
8279 Keyboard / Display Interface
An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from.
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
LCD Interfacing using Atmega 32
Module 12: I/O Systems I/O hardware Application I/O Interface
80C51 Block Diagram ECE Overview.
LCD AND KEYBOARD INTERFACING
COMP541 Input Devices: Keyboards, Mice and Joysticks
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
Arduino & its hardware interfacing
Microcontroller basics
OBJECTIVE AND FEATURES:
COMP2121: Microprocessors and Interfacing
COMP541 Input Devices: Keyboards, Mice and Joysticks
ATMEGA 32 CONNECTIONS TO RS232; UDR AND UCSR REGISTERS
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
E3165 DIGITAL ELECTRONIC SYSTEM
Keyboard/Display Controller INTEL 8279
Atmega32 Serial Programming Basics
Computer Organization and Design
Introduction to Microprocessors and Microcontrollers
EEL 3705 / 3705L Digital Logic Design
Keypad Source: under under
Lecturer: Reza Arjmandi Autumn 2015
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
82C55 Programmable Peripheral Interface
Debugging Debug environments Debug via serial
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Keypad Source: under under
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Keypad Source: under under
Compiled by Dr. N.Shanmugasundaram, HOD, ECE Dept, SECE.
LCD AND KEYBOARD INTERFACING
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

INTERFACING KEYBOARD WITH ATMEGA32 ELECTRONICS & COMMUNICATION TITLE

SUBJECT MICROCONTROLLER & ITS INTERFACING POWERPOINT PRESENTATION AS A PART OF ALA SUBMISSION BY : NAME : SHUBHAM A. KANORIA ENROLL : DEPT : E.C. SEMESTER : 5 TH ELECTRONICS & COMMUNICATION TOPIC : I NTERFACING KEYBOARD WITH ATMEGA32

A PC keyboard is an old and trusted human machine interface. Most peoples are familiar with it. When a text entry is required it is the best method. If we can interface the PC keyboard with an AVR MCU. We can create a whole lot of interesting applications! This presentation will focus on our easy to use PS2 keyboard library for AVR MCU. ELECTRONICS & COMMUNICATION

The PS2 Keyboard library for AVR has only two functions one for initializing the library and one for reading a ASCII character from the queue. The keyboard library automatically translates the scan codes to ASCII characters and buffers them in a FIFO queue. That means even if the CPU is busy doing something else and a character arrives from the keyboard, it will be automatically buffered in a queue. After that the CPU can read the characters anytime when it is free. ELECTRONICS & COMMUNICATION

Only two I/O lines used. One line is also connected to external interrupt pin of AVR. No external components is needed for interface; Included C source reads from keyboard interface and converts to serial In many situations you need some kind of human interface to your microcontroller project. In this example is interfacing AVR microcontroller to standard PC AT keyboard described. ELECTRONICS & COMMUNICATION

In a keyboard interface signal lines are open collector with pull-up resistors. Keyboard cable connectors can be DIN or Mini DIN (We are not talking about USB interface): ELECTRONICS & COMMUNICATION

According to keyboard timing diagram in bellow picture the keyboard transfers data to host AVR microcontroller. The protocol is: one start bit (always 0), eight data bits, one odd parity bit and one stop bit (always 1). The data is validated during the low period of clock pulse. Clock signal is generated by keyboard and pulses are about us low and high. ELECTRONICS & COMMUNICATION

The keyboard has a scan code associated with each key. When key is press – the code is transmitted. If key is is hold down for a while the code is transmitted repeatedly (about 10 times per s). After key is released the brake code is transmitted ($F0). Usually all keys have 8 bit length codes except some keys like Home, Insert and Delay have an extended codes from two to five bytes. The first bytes is always $E0. This is also true for the “break” sequence e.g. E0 F0 xx… The keyboard can handle three sets of scan codes. Default is set Two which is used in this example. The code in example is a simple keyboard to RS232 interface. Scanned codes are translated to ASCII characters and transmitted by USART. The code included in example can be adapted to any AVR microcontroller with SRAM. ELECTRONICS & COMMUNICATION

#include //Keypad Information #define R0 0 #define R1 1 #define R2 2 #define R3 3 #define C0 4 #define C1 5 #define C2 6 #define C3 7 Program for Interfacing

ELECTRONICS & COMMUNICATION #define keypadPORT PORTA #define keypadPIN PINA #define keypadDDR DDRA //Keypad functions and global variables char getkey(); int keypadRow[] = {R0, R1, R2, R3}; //rows of the keypad int keypadCol[] = {C0, C1, C2, C3};//columnd int main() { char key_pressed; keypadDDR |= (1<<R0)|(1<<R1)|(1<<R2)|(1<<R3);//set upper part of keypad port as output //this will be required for scanning the rows keypadDDR &= ~((1<<C0)|(1<<C1)|(1<<C2)|(1<<C3));//set lower part of keypad port as input. // This is the part of the keypad port where the rows are connected.

ELECTRONICS & COMMUNICATION LCD_init(); //initialize LCD while(1) { key_pressed = getkey(); switch(key_pressed) { case('A'): break;//do nothing if no key is pressed default: send_char(key_pressed);//send the key pressed to LCD } return 0; } char getkey() { int i, j; for(i = 0; i < 4; i++) { keypadPORT = 0x00;

ELECTRONICS & COMMUNICATION keypadPORT |= (1 << keypadRow[i]);//send a high to a particular row of the keypad for(j = 0; j < 4; j++) { if(bit_is_set(keypadPIN,keypadCol[j]))//check if key is pressed { while(bit_is_set(keypadPIN,keypadCol[j])); //wait for key to be released switch(i) { case(0): { if (j == 0) return '7'; else if (j == 1) return '8'; else if (j == 2) return '9'; else if (j == 3) return '/'; break; } case(1): { if (j == 0) return '4'; else if (j == 1) return '5'; else if (j == 2) return '6'; else if (j == 3) return '*';

ELECTRONICS & COMMUNICATION break; } case(2): { if (j == 0) return '1'; else if (j == 1) return '2'; else if (j == 2) return '3'; else if (j == 3) return '-'; break; } case(3): { if (j == 0) return '?'; else if (j == 1) return '0'; else if (j == 2) return '='; else if (j == 3) return '+'; break; } return 'A';//Return 'A' if no key is pressed. }

THANK YOU ELECTRONICS & COMMUNICATION