5. 55
INSTRUCTION FORMATINSTRUCTION FORMAT
OP CODE OPERANDINSTRUCTION
Assembly Language
ADDITION of value at 5 and value at 7
MULTIPLICATION of value in A and value in B
ADD 5,7
MUL AB
7. 77
ADDRESSING MODESADDRESSING MODES
Direct Addressing Mode
In direct addressing the operand is
specified by an 8-bit address as field in the
instruction.
Only internal Data RAM and SFRs can be
directly addressed.
9. 99
ADDRESSING MODESADDRESSING MODES
Register Addressing Mode
The content of registers can be accessed by
certain instructions with register name.
Instructions that access the registers this
way are code efficient, since this mode
eliminates an address byte.
One of four banks is selected at execution
time by the two bank select bits in PSW.
10. 1010
ADDRESSING MODESADDRESSING MODES
Indirect Addressing Mode
In indirect addressing the instruction
specifies a register which contains the
address of the operand.
Both internal and external RAM can be
indirectly addressed.
12. 1212
5 Groups5 Groups
Arithmetic Operation GroupArithmetic Operation Group
Logical Operation GroupLogical Operation Group
Data Transfer GroupData Transfer Group
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
Program Branching GroupProgram Branching Group
INSTRUCTION SETINSTRUCTION SET
13. 1313
5 Groups5 Groups
Arithmetic Operation GroupArithmetic Operation Group
Logical Operation GroupLogical Operation Group
Data Transfer GroupData Transfer Group
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
Program Branching GroupProgram Branching Group
INSTRUCTION SETINSTRUCTION SET
17. 1717
Arithmetic Operation GroupArithmetic Operation Group
INC AINC A INC AINC A
INC DirectINC Direct INC 25INC 25
INC RnINC Rn INC R1INC R1
INC @RiINC @Ri INC @R3INC @R3
INC DPTRINC DPTR INC DPTRINC DPTR
Increment
18. 1818
Arithmetic Operation GroupArithmetic Operation Group
DEC ADEC A DEC ADEC A
DEC DirectDEC Direct DEC 25DEC 25
DEC RnDEC Rn DEC R1DEC R1
DEC @RiDEC @Ri DEC @R3DEC @R3
Decrement
19. 1919
Arithmetic Operation GroupArithmetic Operation Group
MULMUL ABAB A <= (A/B), B<= (A%B)A <= (A/B), B<= (A%B)
DIVDIV ABAB A <= (A/B), B<= (A%B)A <= (A/B), B<= (A%B)
DADA AA Decimal Adjust AccumulatorDecimal Adjust Accumulator
Multiplication and Division, Decimal Adjust
20. 2020
5 Groups5 Groups
Arithmetic Operation GroupArithmetic Operation Group
Logical Operation GroupLogical Operation Group
Data Transfer GroupData Transfer Group
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
Program Branching GroupProgram Branching Group
INSTRUCTION SETINSTRUCTION SET
24. 2424
Logical Operation GroupLogical Operation Group
CLRCLR AA Clear AccumulatorClear Accumulator
CPLCPL AA Complement AccumulatorComplement Accumulator
RLRL AA Rotate Accumulator LeftRotate Accumulator Left
RLCRLC AA Rotate Accumulator Left Through CarryRotate Accumulator Left Through Carry
RRRR AA Rotate Accumulator RightRotate Accumulator Right
RRCRRC AA Rotate Accumulator Right Through CarryRotate Accumulator Right Through Carry
SWAP ASWAP A Swap Lower & Upper nibble of AccumulatorSwap Lower & Upper nibble of Accumulator
Clear, Rotation and Swap
25. 2525
5 Groups5 Groups
Arithmetic Operation GroupArithmetic Operation Group
Logical Operation GroupLogical Operation Group
Data Transfer GroupData Transfer Group
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
Program Branching GroupProgram Branching Group
INSTRUCTION SETINSTRUCTION SET
28. 2828
Data Transfer GroupData Transfer Group
MOV @Ri,DirectMOV @Ri,Direct
MOV DPTR,#DATA16MOV DPTR,#DATA16
MOVC A,@A+DPTRMOVC A,@A+DPTR
MOVC A,@A+PCMOVC A,@A+PC
MOVX A,@RiMOVX A,@Ri
MOVX @Ri,AMOVX @Ri,A
MOVX @DPTR,AMOVX @DPTR,A
MOVE data
29. 2929
Data Transfer GroupData Transfer Group
PUSH DirectPUSH Direct
POPPOP DirectDirect
XCHXCH A,RnA,Rn
XCHXCH A,DirectA,Direct
XCHXCH A,@RiA,@Ri
XCHD A,@RiXCHD A,@Ri
30. 3030
5 Groups5 Groups
Arithmetic Operation GroupArithmetic Operation Group
Logical Operation GroupLogical Operation Group
Data Transfer GroupData Transfer Group
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
Program Branching GroupProgram Branching Group
INSTRUCTION SETINSTRUCTION SET
31. 3131
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
CLRCLR CC Clear Carry FlagClear Carry Flag
CLRCLR bitbit Clear the specified bitClear the specified bit
SETBSETB CC Set Carry Flag to 1Set Carry Flag to 1
SETB bitSETB bit Set the specified bit to 1Set the specified bit to 1
CPLCPL CC Complement Carry FlagComplement Carry Flag
CPLCPL bitbit Complement the specified bitComplement the specified bit
Operations on Bit
32. 3232
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
ANLANL C,bitC,bit AND Carry flag with the specified bitAND Carry flag with the specified bit
ANLANL C,/bitC,/bit AND Carry with complement of specified bitAND Carry with complement of specified bit
ORLORL C,bitC,bit AND Carry flag with the specified bitAND Carry flag with the specified bit
ORLORL C,/bitC,/bit OR Carry with complement of specified bitOR Carry with complement of specified bit
MOVMOV C,bitC,bit Copy Carry flag to the specified bitCopy Carry flag to the specified bit
MOVMOV bit,Cbit,C Copy the specified bit to Carry flagCopy the specified bit to Carry flag
Operations on Bit
33. 3333
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
JCJC relrel Jump to the relative location if Carry flag is 1Jump to the relative location if Carry flag is 1
JNCJNC relrel Jump to the relative location if Carry flag is 0Jump to the relative location if Carry flag is 0
JBJB bit,relbit,rel Jump to the relative location if specified bit is 1Jump to the relative location if specified bit is 1
JNBJNB bit,relbit,rel Jump to the relative location if specified bit is 0Jump to the relative location if specified bit is 0
JBCJBC bit,relbit,rel Jump to the relative location if specified bit is 1Jump to the relative location if specified bit is 1
and then Clear the bitand then Clear the bit
Conditional Jump Operations based on Bit
34. 3434
5 Groups5 Groups
Arithmetic Operation GroupArithmetic Operation Group
Logical Operation GroupLogical Operation Group
Data Transfer GroupData Transfer Group
Boolean Variable Manipulation GroupBoolean Variable Manipulation Group
Program Branching GroupProgram Branching Group
INSTRUCTION SETINSTRUCTION SET
35. 3535
Program Branching GroupProgram Branching Group
ACALLACALL addr11addr11
LCALLLCALL addr16addr16
RETRET
RETIRETI
AJMPAJMP addr11addr11
LJMPLJMP addr16addr16
SJMPSJMP relrel
41. 4141
Simple ProgramsSimple Programs
1.To add two 8 bit numbers which are stored at 4200
& 4201 and store the sum at 4202
2.To subtract an 8 bit numbers which are stored at
4250 from another 8 bit number stored at 4251 and
store the difference at 4252.
3.To multiply two 8 bit numbers which are stored at
4301 & 4302 and store the results at 4310&4311.
4.To divide an 8 bit numbers which are stored at 4220
with another 8 bit number stored at 4221 and
store the result at 4225 & 4226.
5.To exchange lower & upper nibble of an 8 bit
number which is stored at 4201.
42. 4242
Simple ProgramsSimple Programs
6.To clear 2 middle bits of a number which is stored at
4150.
7.To set all bits of 4201 if the number stored at 4200 is
even otherwise clear it.
8.To compare two numbers stored at 4200 & 4201
and store the highest no in 4202.
9.To add two 16 bit numbers which are stored at 4201
& 4202 and 4203 & 4204 . Store the result at 4205 &
4206 .
10.To fill ten locations starting from 4300 with ‘AA’
11.To move 10 continuous numbers stored in memory
location starting from 4300 to 4350.
12.To find average of an array of ten numbers stored
from the locations starting from 4500 and store the
result at 450A.
45. 4545SKB'sSKB's
INTERRUPTS
The Interrupt structure has the following features:
• 6 sources / 5 vectored interrupts
• Each interrupts can be individually programmable
• Each interrupts can have two priority levels
• Priority levels can be programmed
• All interrupts can be masked by a single bit - EA
• External interrupt type can be programmed
Edge triggered
Level Triggered