MSP430 flash LED use timer
no vote
Application background timer is used to flash LED. For each overflow, the timer generates an interrupt, which is used to blink. Since the clock of the timer is controlled by smclock (running at about 1MHz), the overflow number of 8 flashes approximately every 0.5 seconds. &Key technology this example uses a timer clock from smclock. This clock is based on the current frequency of 1MHz. In this case, we want the led to switch every 0.5s. Using the above formula, we can calculate how to program the timer. The result is 524288, which is 8 times 65536. The timer will generate an overflow interrupt and reset once, reaching 65536. Because we have to count to 524288, after every 8 overflow interrupt, LED will be switched.