RL78/G13 Safety Function (Frequency Detection)
R01AN0956EJ0100 Rev. 1.00 Page 2 of 70
Feb. 27, 2012
Contents
1.
Specifications......................................................................................................................................4
2. Operation Check Conditions................................................................................................................. 5
3. Related Application Note...................................................................................................................... 5
4. Description of the Hardware................................................................................................................. 6
4.1 Hardware Configuration Example ......................................................................................................... 6
4.2 List of Pins to be used .......................................................................................................................... 7
5. Description of the Software .................................................................................................................. 8
5.1 Operation Outline ................................................................................................................................8
5.2 File Configuration.............................................................................................................................. 10
5.3 List of Option Byte Settings................................................................................................................ 11
5.4 List of Constants................................................................................................................................12
5.5 List of Variables................................................................................................................................13
5.6 List of Functions................................................................................................................................14
5.7 Function Specifications ...................................................................................................................... 15
5.8 Flowcharts ........................................................................................................................................24
5.8.1 Initialization Function..............................................................................................................................25
5.8.2 System Function......................................................................................................................................26
5.8.3 I/O Port Setup..........................................................................................................................................27
5.8.4 CPU Clock Setup.....................................................................................................................................28
5.8.5 TAU0 Setup.............................................................................................................................................29
5.8.6 Real-Time Clock Setup............................................................................................................................35
5.8.7 Interval Timer Setup................................................................................................................................36
5.8.8 External Interrupt Input Setup .................................................................................................................37
5.8.9 Main Processing ......................................................................................................................................38
5.8.10 Starting INTP0 External Interrupt Processing.........................................................................................41
5.8.11 Starting Pulse Interval Measurement.......................................................................................................42
5.8.12 Starting Channel 5 of TAU0....................................................................................................................43
5.8.13 Stopping Channel 5 of TAU0..................................................................................................................44
5.8.14 Getting Count Clock Change Request Flag.............................................................................................45
5.8.15 Getting Pulse Interval Measurement End Flag........................................................................................46
5.8.16 Judging Pulse Interval Measurement Value ............................................................................................47
5.8.17 Getting Pulse Interval Measurement Value.............................................................................................48
5.8.18 Clearing Pulse Interval Measurement End Flag ......................................................................................49
5.8.19 Changing Count Clock ............................................................................................................................50
5.8.20 Changing HOCO Clock...........................................................................................................................51
5.8.21 Starting LED Blink..................................................................................................................................52
5.8.22 Stopping LED Blink................................................................................................................................53
5.8.23 Starting Real-Time Clock........................................................................................................................54
5.8.24 Stopping Real-Time Clock......................................................................................................................55
5.8.25 Starting Real-Time Clock Fixed-Frequency Interrupt.............................................................................56
5.8.26 Stopping Real-Time Clock Fixed-Frequency Interrupt ...........................................................................57
5.8.27 Clearing Count Clock Change Request Flag ...........................................................................................58
5.8.28 Interval Timer Interrupt...........................................................................................................................59