Keil Logo

CJNE

Compare and jump if not equal

Description  

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_data, relative_offset
C AC F0 RS1 RS0 OV P
Bytes   3
Cycles   2
Encoding   1011011n, immediate, relative_offset
Operation  
CJNE
PC = PC + 3
IF (Rn) <> immedate
  PC = PC + relative_offset

IF (Rn) < immediate
  C = 1
ELSE
  C = 0
Example  
CJNE @R1, #24H, LABEL
CJNE A, #immediate_data, relative_offset
C AC F0 RS1 RS0 OV P
Bytes   3
Cycles   2
Encoding   10110100, immediate, relative_offset
Operation  
CJNE
PC = PC + 3
IF A <> immediate
  PC = PC + relative_offset

IF A < immediate
  C = 1
ELSE
  C = 0
Example  
CJNE A, #01H, LABEL
CJNE A, direct_address, relative_offset
C AC F0 RS1 RS0 OV P
Bytes   3
Cycles   2
Encoding   10110101, direct_address, relative_offset
Operation  
CJNE
PC = PC + 3
IF A <> (direct_address)
  PC = PC + relative_offset

IF A < (direct_address)
  C = 1
ELSE
  C = 0
Example  
CJNE A, 60h, LABEL
CJNE Rn, #immediate_data, relative_offset
C AC F0 RS1 RS0 OV P
Bytes   3
Cycles   2
Encoding   10111nnn, immediate, relative_offset
Operation  
CJNE
PC = PC + 3
IF Rn <> immedate
  PC = PC + relative_offset

IF Rn < immediate
  C = 1
ELSE
  C = 0
Example  
CJNE R6, #12H, LABEL
  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.