Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Project 4

LCD Keypad Door lock

Door

Please refer to Board 2 Schematic v1.pdf

Combining All!

Program allow us to combine projects to become another project, adding some creativity Pop! Now, lets combine keypad, LCD and Door lock to make a Door security system.

Writing Program

Create a project name as Door Security.mcp Start with Keypad.c file and save as Door Security.c:

Start with include pic.h CONFIG Define pins Define registers Define sub-functions Start main

Initiate IO Create start button . Your program

Writing Header file


Define all pins and variables: Define functions prototype:


void init_IO(void); void scan_keypad(void); init_IO() scan_keypad()

Prepare functions:

Guide Lines
# include <pic.h> #define LED1 RE2 . . unsigned char key = 0;

Guide Lines
void init_io ( void ) { TRISA = 0b11011111; TRISB = 0b00000000; TRISC = 0b10000000; TRISD = 0b11111100; TRISE = 0b00000000; PORTA = 0b00000000; PORTB = 0b00000000; PORTC = 0b00110000; PORTD = 0b00000000; PORTE = 0b00000000; }

Now! The C code


Remember to include the header file. In the main:


Initiate IO, setup PWM Display: ADTEC KULIM Password Scan Key and wait Compare password Control door lock

Assignments!

Now, create program to set password!

You might also like