Example: Flashing an LED

Example: Flashing an LED

The example just given is rather abstract. Here we present another example of a timer-driven interrupt service routine. In this case, we use the timer to flash an LED on and off at regular time intervals (Listing 13.4).

Note that in this application we are using Timer 1 overflows to invoke the ISR. As we discussed in Chapter 11, Timer 1 does not have a 16-bit ‘auto reload’ mode; as a consequence, the timer must be manually reloaded every time it overflows: the function Timer_1_Manual_Reload() carries out this operation.

An introduction to schedulers-0229

An introduction to schedulers-0230

 

An introduction to schedulers-0231

Leave a comment

Your email address will not be published. Required fields are marked *