EasyManuals Logo

Intel MCS 51 User Manual

Intel MCS 51
334 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #65 background imageLoading...
Page #65 background image
it@l.
MCS’@-51PROGRAMMER’SGUIDE AND INSTRUCTION SET
CJNE <dest-byte>,<src-byte>,rel
Function:
Description:
Compareand Jump if Not Equal.
CJNEcomparesthe magnitudesofthe fmt twooperands,andbranchesif their valuesare not
equal.The branch destinationis computedby addingthe signedrelative-displacementin the
last instructionbyte to the PC, after incrementingthe PC to the start of the nextinstruction.
The carry flag is set if the unsignedintegervalueof <dest-byte> is less than the unsigned
integervalueof <src-byte>; otherwise,the carry is cleared.Neither operandis tided.
The first two operandsallow four addressingmodecombinations:the Accumulatormay be
comparedwithany directlyaddressedbyteor immediateda~ andanyindirectRAMlocation
or worldngregister can be comparedwithan immediateconstant.
The Accumulator contains 34H. Register 7 contains 56H. The first instruction in the se-
quence
CJNE R7,#60H, NOT-EQ
. . . . . ; R7 = 60H.
NOT—EQ:
JC
REoLLOw
; IF R7 < &3H.
. .. . . . . .
; R7 > 60H.
setsthecarryflagandbranchesto the instructionat labelNOT-EQ. Bytestingthe carry flag,
this instructiondetermines whetherR7 is greater or lessthan 60H.
If the data beingpresentedto Port 1is also 34H,then the instruction,
WAIT: CJNE A,P1,WAIT
clearsthe carry tlag and continueswiththe nextinstructionin sequence,sincetheAccumula-
tor doesequalthe data read fromP1.(If someothervaluewasbeinginputon Pl, theprogram
willloopat this point until the PI data changesto 34H.)
CJNE A,direct,rel
Bytes: 3
Cycles: 2
Encoding:
1o11
0101
I ‘ire”addressI EiEl
Operation:
(PC) - (PC) + 3
IF (A) <> (direct)
THEN
(PC)+ (PC) + relativeoffket
IF (A) <
(direct)
THEN
~L~E (c) -1
(c)+ o
2-35

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel MCS 51 and is the answer not in the manual?

Intel MCS 51 Specifications

General IconGeneral
BrandIntel
ModelMCS 51
CategoryMicrocontrollers
LanguageEnglish

Related product manuals