kk serious question, no jokes.
how do you find elapsed time? either with timers or RTC?


Views: 350

Reply to This

Replies to This Discussion

at this point, ima just gonna reset seconds and take that as the time, like Alex said just fond out about interrupts yesterday

If you want to do it with subtraction, it's quite a tedious process, i did it this way: you have to first convert the 2 BCD digit RTC gives you into proper binary numbers, which means you need a multiply the second digit by 10 and add to the first digit, just add the number to itself 10 times in a loop to multiply. After you did this to both minutes and seconds, you subtract the minutes and seconds, you might get a negative number in seconds in 2's complement, but that's ok, the pic handles it properly without any assistance. Then multiply the difference in minutes by

 60 and add to seconds. That gives you the proper time difference in seconds, then you have to convert this binary difference back into BCD, which involves continually dividing by 10, so you need to write a subroutine for dividing by 10, which is just subtracting in a loop. Then you can display the BCD on the LCD


© 2021   Created by PML.   Powered by

Badges  |  Report an Issue  |  Terms of Service