Username
HOME
TRAINING
WORKSHOP
PROJECTS
KNOWLEDGE CENTRE
ELECTROSHOP
••••••••
ABOUT US
search...
4X4 Keypad Based Password with ATmega32(LCD Display) Posted in 4X4 Keypad
The objective of the project is to interface a 4X4 Keypad and a 16X2 alphanumeric LCD(JHD162A) with avr ATmega32 microcontroller and to design a 4 digit password protection system. The user will enter a 4 digit password and for each key pressed a * will be displayed in 2nd row of 16X2 alphanumeric LCD. After 4 digit password is entered, the system will compare the entered password with the set password (1234 in our case) and the result of the comparison will be displayed in the 2nd row of 16X2 alphanumeric LCD as Password Correct or Wrong Password. The above process will continue forever.
Hardwares Required AVR Trainer Board-100-1pcs AVR USB Programmer-1pcs 12V DC adapter-1pcs 16X2 alphanumeric LCD(JHD162A)-1pcs 4X4 Keypad-1pcs 1 to 1 connector-3pcs 10 to 10 FRC female connector-3pcs USB AM-AF cable(optional)-1pcs
Softwares Required AVR Studio 4 WinAVR -2010 SinaProg Hex Downloader USBasp Driver
Circuit Diagram
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
C Program //System Clock
:1MHz
//AVR Compiler
:AVR-GCC 4.3.2
#include
/*Includes io.h header file where all the Input/Output Registers and its Bits are defined for AVR microcontroller*/ #define
F_CPU
1000000
/*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/ #include /*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/ #define
KEYPAD_PORT
PORTC
/*Defines a macro for the keypad.h header file. KEYPAD_PORT is the microcontroller PORT Register to which 4X4 keypad is connected. Default Port Register in keypad.h header file is PORTB*/ #define
KEYPAD_PIN
PINC
/*Defines a macro for the keypad.h header file. KEYPAD_PIN is the microcontroller PIN Register to which 4X4 keypad is connected. Default PIN Register in keypad.h header file is PINB*/ #include
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
/*Includes keypad.h header file which defines one function, read_keypad function to read the 4X4 keypad*/ #define
LCD_DATA_PORT
PORTB
/*Defines a macro for the lcd.h header File. LCD_DATA_PORT is the microcontroller PORT Register to which the data pins of the LCD are connected*/ #define LCD_CONT_PORT
PORTD
/*Defines a macro for the lcd.h header File. LCD_CONT_PORT is the microcontroller PIN Register to which the control pins of the LCD are connected*/ #define LCD_RS
PD0
/*Defines a macro for the lcd.h header file. LCD_RS is the microcontroller Port pin to which the RS pin of the LCD is connected*/ #define LCD_RW
PD1
/*Defines a macro for the lcd.h header file. LCD_RW is the microcontroller Port pin to which the RW pin of the LCD is connected*/ #define LCD_EN
PD2
/*Defines a macro for the lcd.h header file. LCD_EN is the microcontroller Port pin to which the EN pin of the LCD is connected*/ #include /*Includes lcd.h header file which defines all the functions for all Alphanumeric LCD*/ #include /*Includes string.h header file which includes all the string functions*/
void main(void) { DDRB=0xff; /*All pins of PortB are declared output (data pins of LCD are connected)*/ DDRD=0x07; /*PD0, PD1 and PD2 pins of PortD are declared output (control pins of LCD connected)*/ DDRC=0x0f; //PortC's upper 4 bits are declared input and lower 4 bits are declared output*/ PORTC=0xff; //PortC's lower 4 bits are given high value and pull-up are enabled for higher 4 bits*/ unsigned char count=0, keypad_value, password_set[5] ="1234", password_entered[5]; /*Variable declarations*/ lcd_init(); /*LCD initialization*/ lcd_string_write("ABLab Solutions");
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
/*String display in LCD*/ lcd_command_write(0xc0); /*Cursor moves to 2nd row 1st column of LCD*/ lcd_string_write("www.ablab.in"); /*String display in LCD*/ /*2 second delay*/ _delay_ms(500); _delay_ms(500); _delay_ms(500); _delay_ms(500); /*Start of infinite loop*/ while(1) { lcd_command_write(0x01); /*Clear screen*/ lcd_string_write("Enter Password"); /*String display in LCD*/ lcd_command_write(0xc0); /*Cursor moves to 2nd row 1st column of LCD*/ /*While loop for 4 digit password*/ while(count<4) { keypad_value=read_keypad(); /*Reads 4X4 keypad value*/ /*Checking if any key is pressed or not*/ if(keypad_value != 0xff) { password_entered[count]=keypad_value+48; /*Storing read 4X4 keypad value in ASCII format*/ count++; /*Counter increment*/ lcd_data_write('*'); /* Star(*) display in LCD*/ } else
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
; /*Null statement*/ _delay_ms(250); //250ms delay for guard time*/ } count=0; /*Counter set to 0*/ password_entered[4]=0; /*Null character at the last of array (password_entered) to convert it to a string*/ lcd_command_write(0x01); /*Clear screen*/ /*Password Comparison*/ if(!(strcmp(password_set,password_entered))) lcd_string_write("Password Correct"); /*String display in LCD*/ else lcd_string_write("Wrong Password"); /*String display in LCD*/ /*2 second delay*/ _delay_ms(500); _delay_ms(500); _delay_ms(500); _delay_ms(500); } } /*End of program*/
Connection Guide The step-by-step procedures for the project, 4X4 Keypad based Password with ATmega32 (LCD display) are as follows: Insert the DC Pin of 12V DC Adapter to the DC Socket of AVR Trainer Board-100 Connect PORTB header with LCD data header of AVR Trainer Board-100 with a 10 to 10 FRC Female Connector. Connect RS, RW & EN pin of LCD control header with PD0, PD1 & PD2 pin of PORTD header respectively of AVR Trainer Board-100 with 1 to 1 Connectors. Connect the ISP header of AVR Trainer Board-100 with AVR USB Programmer header with a 10 to 10 FRC Female Connector. Connect the 16X2 Alphanumeric LCD to the LCD header of AVR Trainer Board-100. Connect the 4X4 Keypad header with PORTC header of AVR Trainer Board-100 with a 10 to 10 FRC Connector. Connect the AVR USB Programmer to the PC/Laptop’s USB Port. Switch on the power with the help of Power Switch of AVR Trainer Board-100 Download the 4X4 Keypad based Password with ATmega32 (LCD display) Hex file to AVR Trainer Board-100. Enter the password and see the output.
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
Like
0
Training
Workshops
Robotics
Robo-Manual
Advanced Robotics
Robo-Begin
Embedded Systems
Robo Sumo
Advanced Embedded
Robo-Mobile
Systems
Robo-PC
Mobile Making
Robo-Touch
Wireless Communication
Robo-Gravity
PCB Designing
Projects Dual Tone Multiple Frequency RS-232 Communication IR Communication GPS and GSM Communication Bluetooth Communication
Identification
Robo-Tracker
Biometric Finger Print
Robo-BTooth MSYS-Mobile PCB Design
About Us About Us
Sample Codes
Our Clients Business Associates
Facebook ABLab Solutions Like 1,201 people like ABLab Solutions.
Photo Gallery Careers Contact Us
Radio Frequency
Robo-SMS
Robo-iRemote
Knowledge Centre
Fac ebook s oc ial plugin
Sensor Touch Screen Sensor Accelerometer Sensor Temp., Humidity, Heart Beat & Gas Sensors IR & Ultrasonic Sensors Keypad Robotics RF Communication ZigBee Communication
Privacy Policy
Sitemap
Copyright © 2013 Ablab Solutions. All Rights Reserved
open in browser PRO version
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com