beautypg.com

15 endloop end loop – Texas Instruments MSP50C614 User Manual

Page 188

background image

Individual Instruction Descriptions

4-96

4.14.15

ENDLOOP

End Loop

Syntax

[label]

name

#

Clock,

clk

Word,

w

With RPT,

clk

Class

ENDLOOP

[

n]

1

1

N/R

9d

Execution

If (R4

0)

decrement R4 by

n (1 or 2)

PC

first address after BEGLOOP

else
NOP
PC

PC + 1

Flags Affected

None

Opcode

Instructions

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

ENDLOOP

n

1

1

1

1

1

1

1

1

0

0

0

0

1

0

0

0

n

Description

This instruction marks the end of a loop defined by BEGLOOP. If register R4
is not negative, R4 is decremented by

n and the loop is executed again

beginning with the first instruction after the BEGLOOP. If R4 is negative, a
NOP instruction is executed and program exits the loop. Interrupts (queued by
BEGLOOP) are processed according to their priority. This instruction results
in an overhead of one instruction cycle per loop cycle compared to two
instruction cycle if branching is used. If ENDLOOP is used without any
argument, it assumes

n =1.

See Also

BEGLOOP, INTE

Example 4.14.15.1

See Example 4.14.7.1 in BEGLOOP.