
























Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Prepare-se para as provas
Estude fácil! Tem muito documento disponível na Docsity
Prepare-se para as provas com trabalhos de outros alunos como você, aqui na Docsity
Os melhores documentos à venda: Trabalhos de alunos formados
Prepare-se com as videoaulas e exercícios resolvidos criados a partir da grade da sua Universidade
Responda perguntas de provas passadas e avalie sua preparação.
Ganhe pontos para baixar
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Comunidade
Peça ajuda à comunidade e tire suas dúvidas relacionadas ao estudo
Descubra as melhores universidades em seu país de acordo com os usuários da Docsity
Guias grátis
Baixe gratuitamente nossos guias de estudo, métodos para diminuir a ansiedade, dicas de TCC preparadas pelos professores da Docsity
set de instruções de operações básicas pro edsim51
Tipologia: Esquemas
1 / 32
Esta página não é visível na pré-visualização
Não perca as partes importantes!
Instructions by opcode 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x00 NOP^ AJMP^ LJMP^ RR^ INC^ INC^ INC^ INC^ INC^ INC^ INC^ INC^ INC^ INC^ INC^ INC 0x10 JBC^ ACALL LCALL RRC^ DEC^ DEC^ DEC^ DEC^ DEC^ DEC^ DEC^ DEC^ DEC^ DEC^ DEC^ DEC 0x20 JB^ AJMP^ RET^ RL^ ADD^ ADD^ ADD^ ADD^ ADD^ ADD^ ADD^ ADD^ ADD^ ADD^ ADD^ ADD 0x30 JNB^ ACALL RETI^ RLC^ ADDC ADDC ADDC ADDC ADDC ADDC ADDC ADDC ADDC ADDC ADDC ADDC 0x40 JC^ AJMP^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL^ ORL 0x50 JNC^ ACALL ANL^ ANL^ ANL^ ANL^ ANL^ ANL^ ANL^ ANL^ ANL^ ANL^ ANL^ ANL^ ANL^ ANL 0x60 JZ^ AJMP^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL^ XRL 0x70 JNZ^ ACALL ORL^ JMP^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV 0x80 SJMP^ AJMP^ ANL^ MOVC DIV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV 0x90 MOV^ ACALL MOV^ MOVC SUBB^ SUBB^ SUBB^ SUBB^ SUBB^ SUBB^ SUBB^ SUBB^ SUBB^ SUBB^ SUBB^ SUBB 0xa0 ORL^ AJMP^ MOV^ INC^ MUL^?^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV 0xb0 ANL^ ACALL CPL^ CPL^ CJNE^ CJNE^ CJNE^ CJNE^ CJNE^ CJNE^ CJNE^ CJNE^ CJNE^ CJNE^ CJNE^ CJNE 0xc0 PUSH^ AJMP^ CLR^ CLR^ SWAP^ XCH^ XCH^ XCH^ XCH^ XCH^ XCH^ XCH^ XCH^ XCH^ XCH^ XCH 0xd0 POP^ ACALL SETB^ SETB^ DA^ DJNZ^ XCHD XCHD DJNZ^ DJNZ^ DJNZ^ DJNZ^ DJNZ^ DJNZ^ DJNZ^ DJNZ 0xe0 MOVX AJMP^ MOVX MOVX CLR^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV 0xf0 MOVX ACALL MOVX MOVX CPL^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV^ MOV
Alphabetical List of Instructions
ACALL Absolute Call ADD, ADDC Add Accumulator (With Carry) AJMP Absolute Jump ANL Bitwise AND CJNE Compare and Jump if Not Equal CLR Clear Register CPL Complement Register DA Decimal Adjust
DEC Decrement Register DIV Divide Accumulator by B DJNZ Decrement Register and Jump if Not Zero INC Increment Register JB Jump if Bit Set JBC Jump if Bit Set and Clear Bit JC Jump if Carry Set JMP Jump to Address JNB Jump if Bit Not Set JNC Jump if Carry Not Set JNZ Jump if Accumulator Not Zero JZ Jump if Accumulator Zero LCALL Long Call LJMP Long Jump MOV Move Memory MOVC Move Code Memory MOVX Move Extended Memory MUL Multiply Accumulator by B NOP No Operation ORL Bitwise OR POP Pop Value From Stack PUSH Push Value Onto Stack RET Return From Subroutine RETI Return From Interrupt RL Rotate Accumulator Left RLC Rotate Accumulator Left Through Carry RR Rotate Accumulator Right RRC Rotate Accumulator Right Through Carry SETB Set Bit SJMP Short Jump SUBB Subtract From Accumulator With Borrow SWAP Swap Accumulator Nibbles XCH Exchange Bytes XCHD Exchange Digits XRL Bitwise Exclusive OR Undefined Undefined Instruction
Syntax: ADD A,operand ADDC A,operand
Instructions OpCode Bytes Flags ADD A,#data 0x24 2 C, AC, OV ADD A,iram addr 0x25 2 C, AC, OV ADD A,@R0 0x26 1 C, AC, OV ADD A,@R1 0x27 1 C, AC, OV ADD A,R0 0x28 1 C, AC, OV ADD A,R1 0x29 1 C, AC, OV ADD A,R2 0x2A 1 C, AC, OV ADD A,R3 0x2B 1 C, AC, OV ADD A,R4 0x2C 1 C, AC, OV ADD A,R5 0x2D 1 C, AC, OV ADD A,R6 0x2E 1 C, AC, OV ADD A,R7 0x2F 1 C, AC, OV
Instructions OpCode Bytes Flags ADDC A,#data 0x34 2 C, AC, OV ADDC A,iram addr 0x35 2 C, AC, OV ADDC A,@R0 0x36 1 C, AC, OV ADDC A,@R1 0x37 1 C, AC, OV ADDC A,R0 0x38 1 C, AC, OV ADDC A,R1 0x39 1 C, AC, OV ADDC A,R2 0x3A 1 C, AC, OV ADDC A,R3 0x3B 1 C, AC, OV ADDC A,R4 0x3C 1 C, AC, OV ADDC A,R5 0x3D 1 C, AC, OV ADDC A,R6 0x3E 1 C, AC, OV ADDC A,R7 0x3F 1 C, AC, OV
Description: Description: ADD and ADDC both add the value operand to the value of the Accumulator, leaving the resulting value in the Accumulator. The value operand is not affected. ADD and ADDC function identically except that ADDC adds the value of operand as well as the value of the Carry flag whereas ADD does not add the Carry flag to the result.
The Carry bit (C) is set if there is a carry out of bit 7. In other words, if the unsigned summed value of the Accumulator, operand and (in the case of ADDC) the Carry flag exceeds 255 Carry is set. Otherwise, the Carry bit is cleared.
The Auxillary Carry (AC) bit is set if there is a carry out of bit 3. In other words, if the unsigned summed value of the low nibble of the Accumulator, operand and (in the case of ADDC) the Carry flag exceeds 15 the Auxillary Carry flag is set. Otherwise, the Auxillary Carry flag is cleared.
The Overflow (OV) bit is set if there is a carry out of bit 6 or out of bit 7, but not both. In other words, if the addition of the Accumulator, operand and (in the case of ADDC) the Carry flag treated as signed values results in a value that is out of the range of a signed byte ( 128 through +127) the Overflow flag is set. Otherwise, the Overflow flag is cleared.
See Also: SUBB, DA, INC, DEC
Operation: AJMP Function: Absolute Jump Within 2K Block Syntax: AJMP code address Instructions OpCode Bytes Flags AJMP page0 0x01 2 None AJMP page1 0x21 2 None AJMP page2 0x41 2 None AJMP page3 0x61 2 None AJMP page4 0x81 2 None AJMP page5 0xA1 2 None AJMP page6 0xC1 2 None AJMP page7 0xE1 2 None
Description: AJMP unconditionally jumps to the indicated code address. The new value for the Program Counter is calculated by replacing the least significant byte of the Program Counter with the second byte of the AJMP instruction, and replacing bits 0 2 of the most significant byte of the Program Counter with 3 bits that indicate the page of the byte following the AJMP instruction. Bits 3 7 of the most significant byte of the Program Counter remain unchaged.
Since only 11 bits of the Program Counter are affected by AJMP, jumps may only be made to code located within the same 2k block as the first byte that follows AJMP.
See Also: LJMP, SJMP
Operation: CJNE Function: Compare and Jump If Not Equal Syntax: CJNE operand1,operand2,reladdr Instructions OpCode Bytes Flags CJNE A,#data,reladdr 0xB4 3 C CJNE A,iram addr,reladdr 0xB5 3 C CJNE @R0,#data,reladdr 0xB6 3 C CJNE @R1,#data,reladdr 0xB7 3 C CJNE R0,#data,reladdr 0xB8 3 C CJNE R1,#data,reladdr 0xB9 3 C CJNE R2,#data,reladdr 0xBA 3 C CJNE R3,#data,reladdr 0xBB 3 C CJNE R4,#data,reladdr 0xBC 3 C CJNE R5,#data,reladdr 0xBD 3 C CJNE R6,#data,reladdr 0xBE 3 C CJNE R7,#data,reladdr 0xBF 3 C
Description: CJNE compares the value of operand1 and operand2 and branches to the indicated relative address if operand1 and operand2 are not equal. If the two operands are equal program flow continues with the instruction following the CJNE instruction.
The Carry bit (C) is set if operand1 is less than operand2, otherwise it is cleared.
See Also: DJNZ
Operation: CLR Function: Clear Register Syntax: CLR register Instructions OpCode Bytes Flags CLR bit addr 0xC2 2 None CLR C 0xC3 1 C CLR A 0xE4 1 None
Description: CLR clears (sets to 0) all the bit(s) of the indicated register. If the register is a bit (including the carry bit), only the specified bit is affected. Clearing the Accumulator sets the Accumulator's value to 0.
See Also: SETB
Operation: CPL Function: Complement Register Syntax: CPL operand Instructions OpCode Bytes Flags CPL A 0xF4 1 None CPL C 0xB3 1 C CPL bit addr 0xB2 2 None
Description: CPL complements operand, leaving the result in operand. If operand is a single bit then the state of the bit will be reversed. If operand is the Accumulator then all the bits in the Accumulator will be reversed. This can be thought of as "Accumulator Logical Exclusive OR 255" or as "
DEC @R0 0x16 1 None DEC @R1 0x17 1 None DEC R0 0x18 1 None DEC R1 0x19 1 None DEC R2 0x1A 1 None DEC R3 0x1B 1 None DEC R4 0x1C 1 None DEC R5 0x1D 1 None DEC R6 0x1E 1 None DEC R7 0x1F 1 None
Description: DEC decrements the value of register by 1. If the initial value of register is 0, decrementing the value will cause it to reset to 255 (0xFF Hex). Note: The Carry Flag is NOT set when the value "rolls over" from 0 to 255.
See Also: INC, SUBB
Operation: DIV Function: Divide Accumulator by B Syntax: DIV AB Instructions OpCode Bytes Flags DIV AB 0x84 1 C, OV
Description: Divides the unsigned value of the Accumulator by the unsigned value of the "B" register. The resulting quotient is placed in the Accumulator and the remainder is placed in the "B" register.
The Carry flag (C) is always cleared.
The Overflow flag (OV) is set if division by 0 was attempted, otherwise it is cleared.
See Also: MUL AB
Operation: DJNZ Function: Decrement and Jump if Not Zero Syntax: DJNZ register,reladdr Instructions OpCode Bytes Flags DJNZ iram addr,reladdr 0xD5 3 None DJNZ R0,reladdr 0xD8 2 None DJNZ R1,reladdr 0xD9 2 None DJNZ R2,reladdr 0xDA 2 None DJNZ R3,reladdr 0xDB 2 None DJNZ R4,reladdr 0xDC 2 None DJNZ R5,reladdr 0xDD 2 None DJNZ R6,reladdr 0xDE 2 None DJNZ R7,reladdr 0xDF 2 None
Description: DJNZ decrements the value of register by 1. If the initial value of register is 0, decrementing the value will cause it to reset to 255 (0xFF Hex). If the new value of register is not 0 the program will branch to the address indicated by relative addr. If the new value of register is 0 program flow continues with the instruction following the DJNZ instruction.
See Also: DEC, JZ, JNZ
Operation: JB Function: Jump if Bit Set Syntax: JB bit addr, reladdr Instructions OpCode Bytes Flags JB bit addr,reladdr 0x20 3 None
Description: JB branches to the address indicated by reladdr if the bit indicated by bit addr is set. If the bit is not set program execution continues with the instruction following the JB instruction.
See Also: JBC, JNB
Operation: JBC Function: Jump if Bit Set and Clear Bit Syntax: JB bit addr, reladdr Instructions OpCode Bytes Flags JBC bit addr,reladdr 0x10 3 None
Description: JBC will branch to the address indicated by reladdr if the bit indicated by bit addr is set. Before branching to reladdr the instruction will clear the indicated bit. If the bit is not set program execution continues with the instruction following the JBC instruction.
See Also: JB, JNB
Operation: JC Function: Jump if Carry Set Syntax: JC reladdr
Instructions OpCode Bytes Flags JC reladdr 0x40 2 None
Description: JC will branch to the address indicated by reladdr if the Carry Bit is set. If the Carry Bit is not set program execution continues with the instruction following the JC instruction.
See Also: JNC
Operation: JMP Function: Jump to Data Pointer + Accumulator Syntax: JMP @A+DPTR Instructions OpCode Bytes Flags JMP @A+DPTR 0x73 1 None
Description: JMP jumps unconditionally to the address represented by the sum of the value of DPTR and the value of the Accumulator.
See Also: LJMP, AJMP, SJMP
Operation: JNB Function: Jump if Bit Not Set Syntax: JNB bit addr,reladdr Instructions OpCode Bytes Flags JNB bit addr,reladdr 0x30 3 None
Operation: JZ Function: Jump if Accumulator Zero Syntax: JNZ reladdr Instructions OpCode Bytes Flags JZ reladdr 0x60 2 None
Description: JZ branches to the address indicated by reladdr if the Accumulator contains the value 0. If the value of the Accumulator is non zero program execution continues with the instruction following the JNZ instruction.
See Also: JNZ
Operation: LCALL Function: Long Call Syntax: LCALL code addr Instructions OpCode Bytes Flags LCALL code addr 0x12 3 None
Description: LCALL calls a program subroutine. LCALL increments the program counter by 3 (to point to the instruction following LCALL) and pushes that value onto the stack (low byte first, high byte second). The Program Counter is then set to the 16 bit value which follows the LCALL opcode, causing program execution to continue at that address.
See Also: ACALL, RET
Operation: LJMP Function: Long Jump Syntax: LJMP code addr Instructions OpCode Bytes Flags LJMP code addr 0x02 3 None
Description: LJMP jumps unconditionally to the specified code addr.
See Also: AJMP, SJMP, JMP
Operation: MOV Function: Move Memory Syntax: MOV operand1,operand Instructions OpCode Bytes Flags MOV @R0,#data 0x76 2 None MOV @R1,#data 0x77 2 None MOV @R0,A 0xF6 1 None MOV @R1,A 0xF7 1 None MOV @R0,iram addr 0xA6 2 None MOV @R1,iram addr 0xA7 2 None MOV A,#data 0x74 2 None MOV A,@R0 0xE6 1 None MOV A,@R1 0xE7 1 None MOV A,R0 0xE8 1 None
MOV R6,A 0xFE 1 None MOV R7,A 0xFF 1 None MOV R0,iram addr 0xA8 2 None MOV R1,iram addr 0xA9 2 None MOV R2,iram addr 0xAA 2 None MOV R3,iram addr 0xAB 2 None MOV R4,iram addr 0xAC 2 None MOV R5,iram addr 0xAD 2 None MOV R6,iram addr 0xAE 2 None MOV R7,iram addr 0xAF 2 None MOV bit addr,C 0x92 2 None MOV iram addr,#data 0x75 3 None MOV iram addr,@R0 0x86 2 None MOV iram addr,@R1 0x87 2 None MOV iram addr,R0 0x88 2 None MOV iram addr,R1 0x89 2 None MOV iram addr,R2 0x8A 2 None MOV iram addr,R3 0x8B 2 None MOV iram addr,R4 0x8C 2 None MOV iram addr,R5 0x8D 2 None MOV iram addr,R6 0x8E 2 None MOV iram addr,R7 0x8F 2 None MOV iram addr,A 0xF5 2 None MOV iram addr,iram addr 0x85 3 None
Description: MOV copies the value of operand2 into operand1. The value of operand2 is not affected. Both operand1 and operand2 must be in Internal RAM. No flags are affected unless the instruction is moving the value of a bit into the carry bit in which case the carry bit is affected or unless the instruction is moving a value into the PSW register (which contains all the program flags).
** Note: In the case of "MOV iram addr,iram addr", the operand bytes of the instruction are stored in reverse order. That is, the instruction consisting of the bytes 0x85, 0x20, 0x50 means "Move the contents of Internal RAM location 0x20 to Internal RAM location 0x50" whereas the opposite would be generally presumed.
See Also: MOVC, MOVX, XCH, XCHD, PUSH, POP
Operation: MOVC Function: Move Code Byte to Accumulator Syntax: MOVC A,@A+register Instructions OpCode Bytes Flags MOVC A,@A+DPTR 0x93 1 None MOVC A,@A+PC 0x83 1 None
Description: MOVC moves a byte from Code Memory into the Accumulator. The Code Memory address from which the byte will be moved is calculated by summing the value of the Accumulator with either DPTR or the Program Counter (PC). In the case of the Program Counter, PC is first incremented by 1 before being summed with the Accumulator.
See Also: MOV, MOVX
Operation: MOVX Function: Move Data To/From External Memory (XRAM) Syntax: MOVX operand1,operand