Question: Questions 1. Timer Functions Arduino IDE provides millis() function that returns the number of milliseconds since the Arduino board began running the current program. millis()

Questions 1. Timer Functions Arduino IDE provides millis() function that returns the number of milliseconds since the Arduino board began running the current program. millis() overflows (goes back to zero) after approximately 50 days (see https:/www.arduino.cc/en/Reference Millis) The millis () function has a very simple structure; it just returns uptime_millis, which keeps track of the system uptime in milliseconds. unsigned long uptime_ millis; // keeps track of system uptime in msec other code to update update_millis unsigned long millis(void) f return uptime_millis; In this homework, your goal is to implement the above millis()function with the timer output-compare function 3 (OC3) on the HCS12 board. You need to generate an interrupt for OC3 so that uptime_millis can be updated while the CPU is executing other part of the program. Your implementation should have the following two functions: 1) void timer_init (void): It initializes and configures the timer and OC3. This function will be called at the very beginning of the main() function. 2) interrupt void TC3_ISR(void): The interrupt service routine (ISR) of OC3. This is the place where uptime_millis should be updated. Questions 1. Timer Functions Arduino IDE provides millis() function that returns the number of milliseconds since the Arduino board began running the current program. millis() overflows (goes back to zero) after approximately 50 days (see https:/www.arduino.cc/en/Reference Millis) The millis () function has a very simple structure; it just returns uptime_millis, which keeps track of the system uptime in milliseconds. unsigned long uptime_ millis; // keeps track of system uptime in msec other code to update update_millis unsigned long millis(void) f return uptime_millis; In this homework, your goal is to implement the above millis()function with the timer output-compare function 3 (OC3) on the HCS12 board. You need to generate an interrupt for OC3 so that uptime_millis can be updated while the CPU is executing other part of the program. Your implementation should have the following two functions: 1) void timer_init (void): It initializes and configures the timer and OC3. This function will be called at the very beginning of the main() function. 2) interrupt void TC3_ISR(void): The interrupt service routine (ISR) of OC3. This is the place where uptime_millis should be updated
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
