The Accumulator
The Accumulator
It is an
8-bit register used for arithmetic, logical, and data transfer operations.
MOV A, #0x25h ; Load the immediate value 0x25 into the accumulator
• MOV A, address: Load a value from a memory location into the accumulator.
MOV A, 30h ; Load the value from internal RAM location 30h into A
2. Arithmetic Instructions
• SUBB A, source: Subtract the source value from the accumulator with borrow.
3. Logical Instructions
• ANL A, source: Perform bitwise AND between the accumulator and the source.
• ORL A, source: Perform bitwise OR between the accumulator and the source.
• XRL A, source: Perform bitwise XOR between the accumulator and the source.
5. Compare Instructions
CJNE A, #0x20, SKIP ; Compare A with 0x20, if not equal, jump to SKIP
SKIP:
6. Increment/Decrement Instructions
INC A ; Increment A, A = 11
DEC A ; Decrement A, A = 9
8. Bit Instructions
In the 8051 microcontroller, numbers themselves do not carry any inherent property indicating
whether they are signed or unsigned. Instead, the interpretation of a number as signed or unsigned
depends on the context of the program and the instructions being executed.
1. Programmer's Context:
o For example:
▪ Unsigned: 255
o In the 8051, all registers and memory locations are 8-bit, so they can hold values in
the range:
▪ 0: Positive number
▪ 1: Negative number (in two's complement)
o The OV flag in the PSW (Program Status Word) register is helpful when dealing with
signed arithmetic. It indicates whether the result of a signed operation has exceeded
the signed range (-128 to 127).
o Example:
o The CY flag in the PSW register indicates a carry in unsigned arithmetic (e.g., when
adding two numbers exceeds 255).
5. Signed-Specific Operations:
Examples
o If numbers are strictly non-negative (e.g., counts, memory addresses), treat them as
unsigned.