Suppose that you have a clock chip operating at 100 kHz, that is, every ten micr
ID: 3677568 • Letter: S
Question
Suppose that you have a clock chip operating at 100 kHz, that is, every ten microseconds the clock will tick and subtract one from a counter. When the counter reaches zero, an interrupt occurs. Suppose that the counter is 16 bits, and you can load it with any value from 0 to 65535. How would you implement a time of day clock with a resolution of one second.
Hint: you only need addition to implement the time of day clock.
Please give an explanation including pseduocode.
Explanation / Answer
#include #include #include using namespace std; void trap_handler(double microSec,int counter) { if(counter>0){ if( microsec/10) counter--; } else{ if(counter==0) coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.