Texas Instruments MSP430x4xx User Manual

Page 83

Advertising
background image

Instruction Set

3-49

RISC 16−Bit CPU

JN

Jump if negative

Syntax

JN

label

Operation

if N = 1: PC + 2

×

offset −> PC

if N = 0: execute following instruction

Description

The negative bit (N) of the status register is tested. If it is set, the 10-bit signed
offset contained in the instruction LSBs is added to the program counter. If N
is reset, the next instruction following the jump is executed.

Status Bits

Status bits are not affected.

Example

The result of a computation in R5 is to be subtracted from COUNT. If the result
is negative, COUNT is to be cleared and the program continues execution in
another path.

SUB

R5,COUNT

; COUNT − R5 −> COUNT

JN

L$1

; If negative continue with COUNT=0 at PC=L$1

......

; Continue with COUNT

0

......
......
......

L$1

CLR

COUNT

......
......
......

Advertising