This project implements a digital stopwatch using the PIC12F1572 microcontroller. The stopwatch uses Timer1 to count milliseconds and displays the elapsed time over UART in the format MM:SS:MS. The project is evaluated using software simulation in MPLAB X IDE.
- Implement a digital stopwatch using Timer1.
- Display elapsed time over UART in the format MM:SS:MS.
- Use software simulation in MPLAB X IDE to evaluate functionality.
- ✅ Timer configuration (1ms resolution)
- ✅ UART data formatting (Sending real-time updates)
- ✅ Interrupt handling
- ✅ Software simulation debugging
- Use Timer1 to count milliseconds.
- Convert time to Minutes:Seconds:Milliseconds (MM:SS:MS) format.
- Send the formatted time over UART every second.
- Use a software breakpoint in MPLAB X to verify correct time updates.
- MPLAB X IDE
- XC8 Compiler
- PIC16F877A Microcontroller
- Proteus (optional)
- Open the project in MPLAB X IDE.
- Ensure the XC8 compiler is selected.
- Build the project to generate the
.hex
or.cof
file. - Alternatively, you can build the project using Visual Studio Code with the MPLAB extension. Set the project output file path, name, and extension using
Ctrl+Shift+P
and selecting "Edit Project Properties".
The circuit simulation can be found here.
Necessary components that can't be changed:
- PIC12(L)F1572/3 microcontroller: To run the program.
- UART module (configured to 8bit receive with 9600 Baud rate): To receive and interpret output.
Optional components depending on your circuit:
- Button: For start/stop.
- 1 Resistors.
After building the project, upload the generated .hex
or .cof
file to the PIC16F877A microcontroller using a suitable programmer. The file can be found in either of the following paths:
- In case of using MPLAB X IDE: dist\default\debug\Timer_Based_Digital_Stopwatch.X.debug.cof
- In case of using Visual Studio Code (if the file name was set as default): out\Timer_Based_Digital_Stopwatch\default.hex
- The code is largely customizable, however for changing USART pins please consult the datasheet
- Ensure all connections are secure and correct.
- Verify the microcontroller is programmed with the correct
.hex
or.cof
file. - Check the power supply to the microcontroller and other components.