Move Code
Instruction | MOVC A,@A+ base-reg |
---|---|
Function | Move Code byte |
Description | The MOVC instructions load the Accumulator with a code byte or constant from program memory. The address of the byte fetched is the sum of the original unsigned 8-bit Accumulator contents and the contents of a 16-bit base register, which may be either the Data Pointer or the PC. In the latter case, the PC is incremented to the address of the following instruction before being added with the Accumulator; otherwise the base register is not altered. Sixteen-bit addition is performed so a carry-out from the low-order eight bits may propagate through higher-order bits. |
Example | A value between 0 and 3 is in the Accumulator. The following instructions will translate the value in the Accumulator to one of four values defined by the DB (define byte) directive. REL_PC: INC A MOVC A,@A+PC RET DB 66H DB 77H DB 88H DB 99H If the subroutine is called with the Accumulator equal to 01H, it returns with 77H in the Accumulator. The INC A before the MOVC instruction is needed to “get around” the RET instruction above the table. If several bytes of code separate the MOVC from the table, the corresponding number is added to the Accumulator instead. |
Variants | MOVC A,@A+DPTR MOVC A,@A+PC |
Instruction | MOVC A,@A+DPTR |
---|---|
Bytes | 1 |
Cycles | 2 |
Encoding | 1 0 0 1 0 0 1 1 |
Operation | A = (A + DPTR) |
Flags Affected | C AC F0 RS1 RS0 OV P |
Example | MOVC A, @A+DPTR |
Bytes: Number of bytes required to encode the instruction. Cycles: Number of instruction cycles required to execute the instruction. Note that there are 12 oscillator cycles to one instruction cycle on a standard 8051. Encoding: Lists the byte encoding for the instruction. Operation: Lists, step-by-step, the operations performed by the instruction. Flags Affected: are highlighted in Bold |
Instruction | MOVC A,@A+PC |
---|---|
Bytes | 1 |
Cycles | 1 |
Encoding | 1 0 0 0 0 0 1 1 |
Operation | PC = PC + 1 A = (A+PC) |
Flags Affected | C AC F0 RS1 RS0 OV P |
Example | MOVC A, @A+PC |
Bytes: Number of bytes required to encode the instruction. Cycles: Number of instruction cycles required to execute the instruction. Note that there are 12 oscillator cycles to one instruction cycle on a standard 8051. Encoding: Lists the byte encoding for the instruction. Operation: Lists, step-by-step, the operations performed by the instruction. Flags Affected: are highlighted in Bold |
Related topics:
8051 Data Transfer Instructions | 8051 MOV Instruction | 8051 MOVX Instruction | 8051 PUSH Instruction | 8051 POP Instruction | 8051 XCH Instruction | 8051 XCHD Instruction
List of topics: 8051
No comments:
Post a Comment