EE 476: Laboratory 4
Security system
Introduction.
You will produce a security system with keypad and LED display. The security
system will be controlled by and report to a administrators PC.
Procedure:
The Keypad:
You will need to get user input from a keypad with the following configuration.
Demonstration keypad scanning code is in ASM
and in C.
Pin 1 -- row 1 2 3 A
Pin 2 -- row 4 5 6 B
Pin 3 -- row 7 8 9 C
Pin 4 -- row * 0 # D
Pin 5 -- col 1 4 7 *
Pin 6 -- col 2 5 8 0
Pin 7 -- col 3 6 9 #
Pin 8 -- col A B C D
(a) Each switch shorts one row to one column.
(b) Each pin should be connected to one bit of an i/o port.
(c) The i/o port pins will be used both as inputs and outputs.
When they are inputs, they should have active pullup resistors.
Serial connection to the PC:
Be sure to read the serial
communication page. The serial port on the yellow board should be connected
to COM2 of the PC. You should use a simple terminal program, such as Hyperterminal,
on the PC connected to COM2. The terminal program should be set to 9600 baud,
no parity, one stop bit, and no flow control. You can use either demo program
as a test that the RS232 connnections and terminal program on the PC are correct.
Connections to the PC assume a RS232 cable with straight-through connection.
Assignment (red text added on 25Feb02)
Write a program in C for the microcontroller with these specifications:
- Wait for the user to enter a 4-digit (digits 0 to
9 inclusive) security code using the keypad. After four digits are
entered:
- Light LED 0 if the code is correct correct, and log the clock time (day:hrs:min)
and 4-digit security code to Hyperterm on the PC.
- Light LED 7 if the code is incorrect, and log the clock time (day:hrs:min)
and security code to the PC, with a indication of incorrect status (for
instance, an astrisk next to the security code).
- Lock out the user for one minute if there are 3 incorrect consecutive
tries.
- The security manager sitting at the PC should be able to:
- Add a new security code. Eight different codes
should be available for demo.
- Delete an existing security code.
- List all existing codes.
- Force an unlock.
- Force a lockdown.
- Set the time and day. The day is given as sequential days counting from
Jan 1.
- The only code running on the PC and interacting with the microcontroller
program should be Hyperterm.
- Keypad entry and security manager interactions must be fully concurrent.
The keypad must operate correctly even when the security manager is communicating
with the microcontroller. Neither the keypad or serial link to the PC can
block while waiting for input.
When you demonstrate the program to a staff member, you should exercise the
keyboard entry functions and PC commands.
Your written lab report should include:
- The scheme you used to decode the keyboard.
- The scheme you used to convert the code to formatted ASCII.
- A schematic of the curcuit you built.
- A heavily commented listing of your code.
Copyright Cornell University Jan 2002