ECE 4760: Laboratory 3
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. The operation
of the PC interface and keypad interface must be fully concurrent.
Procedure:
The Keypad:
You will need to get user input from a keypad as you did in the last lab. The keypad must be debounced.
Serial connection to the PC:
The serial port on the STK500 board should be connected
to the COM port of the PC which has the USB dongle. There is also a jumper on the STK500 which must be added
to enable the serial port. On the PC, the terminal program should be set
to 9600 baud, no parity, one stop bit, and no flow control. A demo program (download ISRserialGCC644.c, uart.c, uart.h, project zip) shows how to set up interrupt-driven serial communication. Because of the concurrency requirement, you will not be able to use scanf in C (which is blocking).
Assignment
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 (debounced) keypad. After four digits are
entered:
- Light LED 0 if the code is 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 4-digit 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. The system must be able to process at least 8 different codes.
- Delete an existing security code.
- List all existing codes.
- Force an unlock at any time.
- Force a lockdown in which no code can open the door.
- Release a lockdown so that correct codes will open the door again.
- 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 simultaneously.
Your written lab report should include the sections mentioned in the policy page, and :
- 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 2009