Chapter 3
Microcomputer Basics 1
8-bit timer operation
III
−
37
3.6 8-bit timer operation
3.6.1
Counting rising edges using the event count
■
Overview
This program uses Timer 1 to count the rising edges of the external signal input from the TM1IO input pin with a
binary counter.
When the external input signal is detected 5 times, an interrupt is generated and LED connected to P44 flashes.
The setting stored in the base register determines the number of rising edge detections that is counted until an
interrupt is generated.
■
Hardware allocation list
Source frequency
fosc (10 MHz)
Ports used
Port 3 (P31)
Event input pin
Timers used
Timer 1
Event count timer
Count clock source
TIM0IO input
Interrupts used
Timer 1 interrupt
LED connected to P44 flashes
Interrupt level
0
Interrupt source
Binary counter underflow