1. Fill in the blanks
1.
(P64) Assembly language instructions for microcontrollers typically consist of opcodes and operands, and can also consist solely of opcodes.
2.
(P68) In the base plus index addressing mode, the data pointer DPTR or program counter PC is used as the base register, and accumulator A is used as the index register.
3.
(P66) Accessing special function registers SFR can only be done using direct addressing mode.
4.
(P89, P94) The range of the offset rel in the instruction JC rel is -128~+127B.
5.
(P70) Data transfer instructions do not affect the carry flag Cy, auxiliary carry flag AC, and overflow flag OV, but they do affect the parity flag P.
6.
(P73) The PUSH instruction pushes onto the stack by incrementing SP by 1, and then sends the data from the directly addressed unit to the unit pointed to by the stack pointer SP.
7.
(P74) The mnemonic for data transfer instructions with external RAM is MOVX, and all data to be sent to external RAM must be transferred via accumulator A.
8.
(P75) The mnemonic for data transfer instructions with ROM is MOVC, and only accumulator A can be used as the target operand.
9.
(P77) The operation performed by the instruction “ADDC A, Rn” is to add the contents of accumulator A with the contents of working register Rn, along with the value of carry Cy, and the result is stored in A.
10.
(P82) The multiplication instruction “MUL AB” places the high 8 bits of the 16-bit product in register B and the low 8 bits in accumulator A.
11.
(P88) The jump instructions “AJMP addr11” and “LJMP addr16” have jump ranges of 2 KB and 64 KB.
12.
(P92) The RETI instruction is specifically for returning from interrupt service routines, popping the top of the stack into PC, while also modifying SP.
13.
(P92) The NOP instruction allows the microcontroller to increment by 1, consuming one machine cycle of time without executing any operation, and is typically used for short delays.
14.
The function of the following code segment is to swap the contents of accumulator A and register B..
PUSH Acc
PUSH B
POP Acc
POP B
2. Multiple Choice Questions
1.
(P42, Chapter 2 original question) During program execution, the current value of PC is ____.
A. The address of the previous instruction being executed
B. The address of the instruction currently being executed
C. The address of the next instruction to be executed
D. The address of the instruction register in the controller
2.
(P75) The read operation for program memory ROM can only use ____.
A. MOV instruction B. PUSH instruction
C. MOVX instruction D. MOVC instruction
3.
(P71) Regarding the instruction “MOV A, @Ri“, which statement is correct? ____.
A. Transfers the contents of R0 to A
B. Uses the contents of register R0 as the address to transfer the operand to A
C. Uses the contents of register R2 as the address to transfer the operand to A
D. Transfers the contents of A to R0
4.
(P75) Regarding the instruction “MOVC A, @A+DPTR”, which statement is correct? ____.
A. Adds the contents of A with the contents of DPTR and transfers to A
B. This is an instruction used for addressing data memory
C. Adds the contents of A with the contents of DPTR to form the operand address, and transfers the data at that address to A
D. This is a direct addressing instruction
5.
(P75) Regarding the instruction “MOVX A, @DPTR”, which statement is correct? ____.
A. Transfers the contents of the internal RAM unit or I/O port pointed to by data pointer DPTR to accumulator A
B. Transfers the contents of the external RAM unit or I/O port pointed to by data pointer DPTR to accumulator A
C. Transfers the contents of the external ROM unit or I/O port pointed to by data pointer DPTR to accumulator A
D. Transfers the 16-bit address of data pointer DPTR to accumulator A
Note: Additional multiple choice questions on the learning platform have already appeared in the fill-in-the-blank section and will not be repeated.
3. Program Analysis Questions
Analyze the following program segments and provide the execution results.
1.
Given that before execution, A=02H, SP=52H, (51H)=00H, (52H)=00H. After executing the following program segment, A= ( ), SP= ( ), (51H)= ( ), (52H)= ( ).
ORG 0000H
MOV A, #02H ; A = 02H
MOV SP, #52H ; SP = 52H
MOV 51H, #00H ; Internal RAM 51H = 00H
MOV 52H, #00H ; Internal RAM 52H = 00H
POP DPH ; Pop stack top data to DPH
POP DPL ; Pop stack top data to DPL
MOV DPTR, #0100H ; DPTR = 0100H
RL A ; Rotate A left
MOV B, A ; B = A
MOVC A, @A+DPTR ; Table lookup (program memory)
PUSH Acc ; Push accumulator A onto stack
MOV A, B ; A = B
INC A ; Increment A by 1
MOVC A, @A+DPTR ; Lookup table again
PUSH Acc ; Push accumulator A onto stack
RET ; Return (does not affect result)
ORG 0100H ; Data storage address
DB 10H, 80H, 30H, 50H, 66H, 88H ; Table data
END
A=88H, SP=50H, (51H)=66H, (52H)=88H.
2.
Assuming A=53H, R0=27H, (27H)=24H, after executing the following instructions, A= ( ).
ANL A, #17H ; Logical AND: A = A & 17H
ORL 17H, A ; Logical OR: RAM[17H] = RAM[17H] | A
XRL A, @R0 ; Logical XOR: A = A ^ RAM[R0] (i.e., RAM[27H])
CPL A ; Accumulator complement: A = ~A
END
A=DBH
3.
If DPTR=EEFFH, SP=50H, A=34H, B=12H, (50H)=30H, then after executing the following instructions, DPH= ( ), DPL= ( ), SP= ( ).
PUSH Acc ; Push A's value onto stack
PUSH B ; Push B's value onto stack
POP DPH ; Pop stack top data to DPH
POP DPL ; Pop stack top data to DPL
POP SP ; Pop stack top data to SP itself
END ; End of program
DPH=12H, DPL=34H, SP=30H