
The 8051 Instruction Set
Atmel 8051 Microcontrollers Hardware Manual 1-14
4316E–8051–01/07
*
(end loop)
DJNZ COUNTER, LOOP
(continue)
The CJNE instruction (Compare and Jump if Not Equal) can also be used for loop con-
trol as in Table 1-12. Two bytes are specified in the operand field of the instruction. The
jump is executed only if the two bytes are not equal. In the example of Figure 12, the two
bytes were the data in R1 and the constant 2AH. The initial data in R1 was 2EH. Every
time the loop was executed, R1 was decremented, and the looping was to continue until
the R1 data reached 2AH.
Another application of this instruction is in “greater than, less than” comparisons. The
two bytes in the operand field are taken as unsigned integers. If the first is less than the
second, then the Carry bit is set (1). If the first is greater than or equal to the second,
then the Carry bit is cleared.
1.10 Read-Modify-
Write Instruction
Features
See Section 2.5.4, page 76.
Comentários a estes Manuais