About Isr

Question

You have 16bit register that increment itself and loops about every second. When the register reach 0xffff it will issue an interupt and will run the function update_time(). There is a function unsigned long get_time() that returns the time. You need to implement the two functions

int cnt = 0;
int save_time;
 
while (cnt++ < 0xffff) {
    save_time = get_time();
    while (get_time() - save_time < 1000);
}

Reference

http://www.techinterviews.com/embedded-firmware-interview-questions

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License