Project Documentation: Multi-Mode Microprocessor System
The goal of this project is to design and implement a microprocessor-based system with three distinct operating modes. The system incorporates a keypad for user input, two 7-segment displays for output, and a relay (or LED) to indicate specific states. The system switches between modes using dedicated keypad inputs and performs unique functionalities in each mode:
- Mode A: Displays a scrolling text (e.g., the user’s name) across the 7-segment displays, mimicking a marquee.
- Mode B: Operates as a timer, counting seconds from 0 to 60. In even seconds, the decimal point (DP) of the 7-segment display is illuminated, and it is turned off during odd seconds.
- Mode C: Functions as a digital lock. The user enters a two-digit code via the keypad, which is checked against a pre-stored password in memory. If the entered code matches, the relay (or LED) is activated to simulate unlocking the door.
The system initializes in Mode A upon power-up.
- Microcontroller: ATMEGA32
- Keypad: 4x3 or 4x4 matrix keypad for user input
- 7-Segment Displays: Two common-anode or common-cathode 7-segment displays
- Relay or LED: Used to simulate door lock/unlock
- Power Supply: 5V DC for the microcontroller and peripherals
- Resistors: Current-limiting resistors for 7-segment displays
- Keypad: Connected to PORTD for scanning rows and columns.
- 7-Segment Displays: Connected to PORTA and PORTB. Multiplexing is used to drive the displays.
- Relay/LED: Connected to PORTC.
- Microcontroller Pins: Configured for input (keypad) and output (7-segment displays and relay/LED).
- Stack pointer initialized.
- I/O ports configured:
- PORTA and PORTB as output for 7-segment displays.
- PORTC as output for relay/LED.
- PORTD as input for the keypad.
- Pre-stored password set in memory.
- Text (e.g., "Saeed") is stored in memory.
- Characters are displayed one at a time by shifting the text across the 7-segment displays.
- A delay function is used to control the speed of scrolling.
- Timer0 is configured in CTC mode with a prescaler to achieve a 1-second delay.
- A counter increments from 0 to 60.
- Even/odd second detection toggles the DP pin of the 7-segment display.
- After reaching 60 seconds, the timer resets.
- The user enters a two-digit code via the keypad.
- The code is displayed on the 7-segment displays in real-time.
- The entered code is compared with the pre-stored password.
- If matched, the green LED is activated for a few seconds.
- If not matched, an error indicator is displayed (red LED is activated for a few seconds).
- Keypad buttons
+
,-
, and*
are used to switch to Modes A, B, and C, respectively. - Debouncing is handled via software delays.
- Keypad Debouncing: Spurious signals from the keypad were mitigated using delays and software filtering.
- Multiplexing Displays: Ensuring clear and flicker-free display required careful timing and synchronization.
- Precise Timing: Achieving accurate 1-second delays for the timer mode was challenging and addressed using Timer0 in CTC mode.
- Memory Management: Efficient use of registers and RAM for storing intermediate data and passwords.
- User Experience: Ensuring smooth transitions between modes and responsive keypad inputs.
This project demonstrates a versatile microprocessor-based system capable of performing multiple tasks using minimal hardware resources. The implementation of three distinct modes showcases the system's flexibility and practical utility in real-world applications, such as digital signage, timing, and security systems.
- Add buzzer feedback for invalid inputs in Mode C.
- Implement EEPROM for persistent storage of the password.
- Add additional text scrolling effects in Mode A.
- Use an RTC (Real-Time Clock) module for precise timekeeping in Mode B.