Download Print this page

Siemens SAB 80515 Series User Manual page 146

8-bit single-chip microcontroller family

Advertisement

CJNE
<dest-byte >, < src-byte >, rel
Function:
Compare and jump if not equal
Description:
CJNE compares the magnitudes of the tirst two operands, and branches if their
values are not equal. The branch destination is computed by adding the signed
relative displacement in the last instruction byte to the PC, after incrementing the
PC to the start of the next instruction. The carry flag is set if the unsigned integer
value of <dest-byte> is less than the unsigned integer value of <src-byte>;
otherwise, the carry is cleared. Neither operand is affected.
The first two operands allow four addressing mode combinations: the accumulator
may be compared with any directly addressed byte or immediate data, and any
indirect RAM location or working register can be compared with an immediate
constant.
Example:
The accumulator contains 34 H . Register 7 contains 56 H . The first instruction in the
sequence
;
NOT_EQ
;
sets the carry flag and branches to the instruction at label NOT_EQ. By testing the
carry flag, this instruction determines whether R7 is greater or less than 60 H .
If the data being presented to port 1 is also 34 H , then the instruction
WAIT:
clears the carry flag and continues with the next instruction in sequence, since the
accumulator does equal the data read from P1. (If some other value was input on
P1, the program will loop at this point until the P1 data changes to 34 H ).
Semiconductor Group
CJNE
R7, # 60 H , NOT_EQ
. . .
. . . . .
JC
REQ_LOW
. . .
. . . . .
CJNE
A,P1,WAIT
*
146
Instruction Set
; R7 = 60 H
; If R7 < 60 H
; R7 > 60 H

Advertisement

loading

This manual is also suitable for:

Sab 80c515Sab 80c535Sab 80535Sab 80515k