Texas Instruments TMS320C28x Reference Manual page 283

Dsp cpu and instruction set
Table of Contents

Advertisement

LOOPNZ loc16,#16bit
Flags and
N
Modes
Z
LOOP
Repeat
Example
; Wait until bit 3 in RegA is cleared before writing to RegB:
LOOPNZ @RegA,#0x0004
MOV
6-126
When any interrupt occurs, the current state of the LOOP bit is saved as ST1
is saved on the stack. The LOOP bit in ST1 is then cleared by the interrupt.
The LOOP bit is a passive status bit. The LOOPNZ instruction changes
LOOP, but LOOP does not affect the instruction.
You can abort the LOOPNZ instruction within an interrupt service routine.
Test the LOOP bit saved on the stack. If it is set, then increment (by 2) the
return address on the stack. Upon return from the interrupt, this incremented
address is loaded into the PC and the instruction following the LOOPNZ is
executed.
If bit 15 of the result of the AND operation is 1, set N; otherwise, clear N.
If the result of the AND operation is 0, set Z; otherwise, clear Z.
LOOP is repeatedly set while the result of the AND operation is not 0. LOOP
is cleared when the result is 0. If an interrupt occurs before the LOOPNZ in-
struction enters the decode 2 phase of the pipeline, the instruction is flushed
from the pipeline and, thus, does not affect the LOOP bit.
This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
@RegB,#0x8000
; Loop while (RegA AND 0x0004 != 0)
; RegB = 0x8000

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C28x and is the answer not in the manual?

Table of Contents

Save PDF