This project implements a hexadecimal up/down counter using the ATmega328P microcontroller, an 8-bit shift register, a 7-segment LED display, and a pushbutton. All software is written in Assembly language and interfaces directly with the hardware components.
The project satisfies all functionality requirements defined in the Lab 2 assignment for the Embedded Systems course.
- Hexadecimal Counter (0–F)
- Increment/Decrement Mode Toggle
- Counter Reset
- Shift Register Output to 7-Segment Display
- Hardware Debounce Implementation
- Decimal Point Indicator for Decrement Mode
- On startup, the display shows
0, and the counter is in increment mode (DP off).
| Button Press Duration | Mode | Action |
|---|---|---|
| < 1 second | Increment | Increase counter (0 → F, wraps to 0) |
| < 1 second | Decrement | Decrease counter (F → 0, wraps to F) |
| 1–2 seconds | Any | Toggle between increment/decrement mode |
| ≥ 2 seconds | Any | Reset counter to 0 (increment mode) |
All button actions are triggered on release, and debouncing is handled via a hardware-based approach.
- Counter value is shown on the 7-segment display.
- Decimal Point (DP) indicates current mode:
- OFF → Increment Mode
- ON → Decrement Mode
- ATmega328P Microcontroller
- 8-bit Shift Register (e.g., 74HC595)
- 7-Segment Common Cathode LED Display
- Pushbutton Switch
- Resistors (to limit current to ≤ 6 mA per segment)
- Breadboard and connecting wires
- Outputs binary values to shift register to light up the correct segments of the display.
- Tracks elapsed time using timer/counter to distinguish between short, medium, and long button presses.
- Manages current state (increment/decrement/reset) and counter value in registers.
- Updates display and DP according to current mode and counter value.
- Connect the ATmega328P to the 74HC595 shift register and 7-segment display following the lab schematic.
- Wire the pushbutton with hardware debounce (capacitor + resistor circuit).
- Assemble and upload the Assembly code to the microcontroller.
- Power the board and test all counter functionalities per the lab instructions.
- February 12: Show interaction between MCU and both pushbutton and display. Debouncing should work.
- February 19: Demonstrate increment functionality including wrap-around from
Fto0.
- One
.asmsource file (this code) - One lab report per group
- Submit via ICON by February 26
- Checkoff required if being graded in person
- Thomas Tsilimigras
- Joshua Abello