![](http://datasheet.mmic.net.cn/30000/M38197MA-XXXKP_datasheet_2360287/M38197MA-XXXKP_166.png)
152
2. APPLICATION
MITSUBISHI MICROCOMPUTER
3819 Group
2.7 Zero cross detection circuit
3819 Group USER’S MANUAL
2.7.4 Zero cross detection circuit application example 2
Clock count using ZCR interrupt (using a noise filter)
Outline : The clock is counted up every second by using the ZCR interrupts.
Specifications : f(XIN)=4 MHz
The noise filter (sampling clock : f(XIN)/256) is used.
(Pulse less than 64
s is eliminated as a noise.)
The commercial frequency (50 Hz or 60 Hz) is input.
The clock is counted up by using the ZCR interrupts.
Figure 2.7.8 shows a setting of related registers.
Fig. 2.7.8 Setting of related registers [Clock count using ZCR interrupt (using a noise filter)]
ZCR active edge : Falling edge active (Note)
INTEDGE
Interrupt edge selection register (Address:3A16)
0
IREQ1
Interrupt request register 1 (Address:3C16)
Set the INT1/ZCR interrupt request bit to “0”
0
ICON1
Interrupt control register 1 (Address:3E16)
INT1/ZCR interrupt : Enabled
1
IREQ1
Interrupt request register 1 (Address:3C16)
ZCR interrupt request
Passing through the zero cross detection circuit (Note)
ZCRCON
Zero cross detection control register (Address:3916)
1
1 1
Noise filter sampling clock : f(XIN)/256
0
Selection of one-sided edge detection
When changing the values of bit 0 of the zero cross detection control register and bit 1 of the
interrupt edge selection register, make sure the following contents.
1. During changeing, set bit 1 of the interrupt control register 1 (disable ZCR interrupt) to “0”.
2. After changeing, set bit 1 of the interrupt request register 1 (no ZCR interrupt request) to “0”.
However, the value of bit 1 of the interrupt request register 1 is changed with a maximum delay
of 2 sampling clocks by using a noise filter. Thus, after changing, set this bit to “0” after a wait
of 2 sampling clocks.
Note :