Chapter 5: Addressing Modes
5.1: Immediate and Register addressing modes
Can the programmer of a microcontroller make up new addressing modes? // unless you’re David Barahona you can’t :p 2.
Show the instruction to load 1000 0000 (binary) into R3 MOV R3, 80H or MOV R3, 1000_0000b
Why is the following invalid?
“MOV R2, DPTR”
DPTR is a 16bit register and CANNOT be loaded into a 8bit register like R2. Unless you break down DPTR into (Data Pointer High) and (Data Pointer Low) which are 8bit register, you can’t do the above instruction. 4.
True or false. DPTR is a 16bit register that is also accessiblte in lowbyte and high byte formats?
Yes! Read #3 lol.
Is the PC (program counter) also avalaible in high and low byte formats? No, the PC is the only 16bit register that cannot be accessed in 8bit formats like the DPTR.
5.2: Accessing Memory using various addressing modes 1.
The instruction “MOV A, 40H” uses ________ addressing mode. Why? It uses direct addressing mode since it is loading the 8bit contents at memory location 40H and loading it into the accumulator register. 2.
What address is assigned to register R2 of bank 0? 02H
What address is assigned to register R2 of bank 2? 12H
What address is assigned to register A?
Which registers are allowed to be used for register indirect addressing mode if the data is in onchip RAM?
In this mode the registers are used as a pointer to the data. R0 and R1 are the only registers used in this addressing mode as pointers (@R0 or @R1).
5.3: Bit Addressing for I/O and RAM
or false. All I/O ports of the 8051 are bitaddressable 2.
. All registers of the 8051 are bitaddressable
. All RAM locations of the 8051 are bitaddressable. 4.
Indicate which of the following registers are bit addressable. a. A b. B c. R4 d. PSW
Of the 128 bytes of RAM in the 8051 , how many bytes are bitaddressable? list them.
RAM locations 20H to 2F are bit addressable. All I/O ports are bit addressable. ACC, B, IE, SCON, TCON, and IP.
How would you check to see whether bit D0 of R3 is high or low? MOV A, R3 // assuming D0 of R3 is the only one on ANL A, 01h // mask the unused bits and test the one we need MOV P1, A // display it for the user on the board 7.
Find out to which byte each of the following bits belongs. Give the address of the RAM in hex.
a. SETB 20 Byte address 24H of Internal RAM
Byte address 26H of Internal RAM
c. SETB 12H Byte address 22H of Internal RAM
d. SETB 95H
Byte address 90H of SFR RAM (port 1)
e. SETB 0E6H
Byte address E0H of SFR RAM (ACC.6)
While bit address 007FH belongs to
bit addresses 80 F7H belong
or false. P0, P1, P2, and P3 are part of the SFR. 10.
or false. Register ACC is bitaddressable
5.4: Not the 8051
5.1 and 5.2:
Which of the following are invaild uses of immediate addressing mode? a. MOV A, #24H
b.MOV R1, 30H
c. MOV R4, #60H
Identify the addressing mode for each of the following: a. MOV B, #34H
b. MOV A, 50H
c. MOV R2, 07
d. MOV R3, #0
e. MOV R7, 0
f. MOV R6, #7FH
g. MOV R0, A
h. MOV B, A
i. MOV A, @R0
j. MOV R7, A
k. MOV A, @R1
Indicate the address assigned to each of the following. a. R0 of bank 0
c. R7 of bank 0
d. R3 of bank 2
f. R7 of bank 3
g. R4 of bank 1
i. R6 of bank 1
j. R0 of bank 3
l. P0 80H
Please join StudyMode to read the full document