Panasonic MN103S Counting rising edges using the event count, Overview, Hardware allocation list

Page 13

Chapter 3

Microcomputer Basics 1

3.6 8-bit timer operation

3.6.1Counting 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

 

 

 

 

8-bit timer operation

III−37

Image 13
Contents MN103S927/92A/F92G LSI Application Notes Excerption Page Page About This Manual Format used for sample program explanations About This Manual3 Page Table of Contents Microcomputer Basics Chapter overview Appendix Table of Contents Overview Counting rising edges using the event countHardware allocation list Timer 1 Base Register TM1BR 0x0000A149 Timer 1 Mode Register TM1MD 0x0000A141 Timer 1 Binary Counter TM1BC 0x0000A151Port 3 I/O Control Register P3DIR 0x0000A023 Port 3 Output Mode Register P3MD 0x0000A033 END FlowchartExample program Enable the interruptCpum URL http//panasonic.co.jp/semicon/e-micom/inquiry InquiriesSales Offices