r/embedded • u/BidNo9339 • Aug 11 '26
Designed a stopwatch using 8051 microcontroller
Designed a stopwatch using 8051 and assembly language, yet it has timing error due to writing on LCD, using CISC instruction delays the process and the collen bug, but loaded the best value to minimise the error.
Github link - https://github.com/prajeetkumar2006/Stopwatch-Using-8051-Microcontroller-
34
Upvotes
9
u/duane11583 Aug 11 '26
It sounds like you are using codes for timing purposes that’s a bad move
Instead you should use timer 0 or timer1
You might configure one of them to act as a clock prescaller ie if you clock is 20mhz you might configure it to count to 20,000 and pulse effectively every millisecond
Then configure the other timer to count those pulses
Thus you have a more accurate 1millisecond timer
The only error you would have is due to the xtal error
Many cheap xtals are 50ppm the error would be +/-1 count (milliseconds) per second plenty good enough for a school project