34.3.3.7 REPEAT
- Set Instruction Repeat
Counter
The REPEAT
instruction is used to store the repeat count value into
the UPDI Repeat Counter register. When instructions are used with
REPEAT
, protocol overhead for SYNCH and Instruction Frame can be
omitted on all instructions except the first instruction after the
REPEAT
is issued. REPEAT
is most useful for memory
instructions (LD
, ST
, LDS
,
STS
), but all instructions can be repeated, except the
REPEAT
instruction itself.
The DATA_SIZE opcode field refers to the size of the repeat value. Only byte
size (up to 255 repeats) is supported. The instruction that is loaded directly after the
REPEAT
instruction will be repeated RPT_0
times.
The instruction will be issued a total of RPT_0 + 1
times. An ongoing
repeat can only be aborted by sending a BREAK
character.
The figure above gives an example of repeat operation with an
ST
instruction using pointer post-increment operation. After the
REPEAT
instruction is sent with RPT_0 =
n, the first ST
instruction is issued
with SYNCH and Instruction frame, while the next n
ST
instructions are executed by only sending in data bytes according to
the ST
operand DATA_SIZE
, and maintaining the
Acknowledge (ACK) handshake protocol.
If using indirect addressing instructions
(LD
/ST
) it is recommended to always use the
pointer post increment option when combined with REPEAT
. Otherwise, the
same address will be accessed in all repeated access operations. For direct addressing
instructions (LDS
/STS
), the address must always be
transmitted as specified in the instruction protocol, before data can be received
(LDS
) or sent (STS
).