
μ
PD17016, 17017
122
12.4.4 Releasing halt status by timer carry
Releasing the halt status by the timer carry is set by the “HALT 0010B” instruction.
When the release of the halt status is set by the timer carry, the halt status is released as soon as the timer
carry FF has been set to “1”.
The timer carry FF corresponds to the BTM0CY flag of the timer carry FF judge register on a one-to-one basis,
as explained in
11. TIMER FUNCTION
, and is set to “1” at fixed time intervals (1 ms, 5 ms, 100 ms, or 250 ms).
Therefore, the halt status can be released at fixed time intervals.
Example
M1
MEM
0.10H
; 1-second counter
; Symbol definition
HLTTMR DAT
0010B
CLR2
BTM0CK1, BTM0CK0
; Embedded macro
; Sets timer carry FF setting time to 250 ms
LOOP:
HALT
HLTTMR
; Sets release condition by timer carry FF and halt status
; Embedded macro
; Branches to LOOP if BTM0CY flag is not set
M1, #0100B
; Adds 0100B to contents of M1
; Embedded macro
; Executes processing A if carry occurs
SKT1
BTM0CY
BR
LOOP
ADD
SKT1
CY
BR
LOOP
Processing A
BR
LOOP
In this example, the halt status is released every 250 ms and processing A is executed every 1 second.
12.4.5 Releasing halt status by interrupt
Releasing the halt status by an interrupt is set by the “HALT 1000B” instruction.
If releasing the halt status by an interrupt is set, the halt status is released as soon as the interrupt has been
acknowledged.
Two interrupt sources, INT
0
pin and timer, are available as explained in
10. INTERRUPT
.
Therefore, the interrupt source to be used to release the halt status must be specified by program in advance.
So that the interrupt is acknowledged, all the interrupts must be enabled (by the EI instruction), each interrupt
is enabled (by setting the corresponding interrupt permission flag), in addition that the interrupt request must
be issued from each interrupt source.
Even if an interrupt request is issued, if that interrupt is not enabled, the interrupt is not acknowledged and
the halt status is not released.
When the halt status has been released because the interrupt has been acknowledged, the program flow
branches to the vector address of the interrupt.
If the “RETI” instruction is executed after the interrupt processing, the program flow returns to the instruction
next to the “HALT” instruction.
Here is an example.