Keil Logo

CJNE

The CJNE instruction compares the first two operands and branches to the specified destination if their values are not equal. If the values are the same, execution continues with the next instruction.

See Also: DJNZ

CJNE @Rn, #immediate, offset
C AC F0 RS1 RS0 OV   P
Bytes 3
Cycles 2
Encoding
1011011n immediate offset
Operation
CJNE
PC = PC + 3
IF (Rn) <> immedate
  PC = PC + offset
IF (Rn) < immediate
  C = 1
ELSE
  C = 0
Example
CJNE @R1, #24H, LABEL
CJNE A, #immediate, offset
C AC F0 RS1 RS0 OV   P
Bytes 3
Cycles 2
Encoding
10110100 immediate offset
Operation
CJNE
PC = PC + 3
IF A <> immediate
  PC = PC + offset
IF A < immediate
  C = 1
ELSE
  C = 0
Example
CJNE A, #01H, LABEL
CJNE A, direct, offset
C AC F0 RS1 RS0 OV   P
Bytes 3
Cycles 2
Encoding
10110101 direct offset
Operation
CJNE
PC = PC + 3
IF A <> (direct)
  PC = PC + offset
IF A < (direct)
  C = 1
ELSE
  C = 0
Example
CJNE A, 60h, LABEL
CJNE Rn, #immediate, offset
C AC F0 RS1 RS0 OV   P
Bytes 3
Cycles 2
Encoding
10111nnn immediate offset
Operation
CJNE
PC = PC + 3
IF Rn <> immedate
  PC = PC + offset
IF Rn < immediate
  C = 1
ELSE
  C = 0
Example
CJNE R6, #12H, LABEL

Related Knowledgebase Articles

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.