Setting The Led Blinking Cycle And Chattering Detection Time - NEC 78K0S/K 1+ Series Application Note

Sample program (16-bit timer/event counter 00) interval timer
Hide thumbs Also See for 78K0S/K 1+ Series:
Table of Contents

Advertisement

4.2

Setting the LED Blinking Cycle and Chattering Detection Time

The LED blinking cycle and chattering detection time are set as follows in this sample program.
(1) Setting the LED blinking cycle
The LED output is reversed every 250 generations of 16-bit timer/event counter 00 interrupts (INTTM000) in
this sample program.
• Interrupt cycle (interval time) = (N + 1)/fsam
• LED output reversal cycle = Interrupt cycle × Number of interrupts
• LED blinking cycle = LED output reversal cycle × 2
Remark
N:
CR000 register setting value
fsam: Count clock frequency of 16-bit timer/event counter 00
Calculation example: The following values result when the CR000 register setting value is 62 (during operation
Furthermore, the CR000 register setting value is changed in accordance with the number of switch inputs, and
the LED blinking cycle is changed.
Number of Switch Inputs
0
1
2
3
Note The blinking cycle from the zeroth switch input is repeated after the fourth switch input.
CHAPTER 4 SETTING METHODS
at fsam = 31.25 kHz).
• Interrupt cycle (interval time) = (N + 1)/fsam = (62 + 1)/31.25 kHz = 2 ms
• LED output reversal cycle = Interrupt cycle × Number of interrupts = 2 ms × 250 = 500
ms
• LED blinking cycle = LED output reversal cycle × 2 = 500 ms × 2 = 1 s
Note
CR000 Register Setting Value
62
31
15
7
Application Note U18887EJ1V0AN
Interrupt Cycle
2.016 ms
((62 + 1)/31.25 kHz)
1.024 ms
((31 + 1)/31.25 kHz)
0.512 ms
((15 + 1)/31.25 kHz)
0.256 ms
((7 + 1)/31.25 kHz)
LED Blinking Cycle
1.008 s
(2.016 ms × 250 × 2)
0.512 s
(1.024 ms × 250 × 2)
0.256 s
(0.512 ms × 250 × 2)
0.128 s
(0.256 ms × 250 × 2)
25

Advertisement

Table of Contents
loading

This manual is also suitable for:

78k0s/ka1+78k0s/kb1+78k0s/ku1+78k0s/ky1+

Table of Contents