Chapter 2: Hardware Structure of the AT89S52 Microcontroller

1. Fill in the blanks

1.

(P34) The AT89S52 microcontroller integrates the CPU, RAM, Flash ROM, timer/counter, multi-functional I/O ports, a “watchdog” timer, and an interrupt system, among other basic functional components, on a single chip.

2.

(P34) The 8-bit CPU of the AT89S52 microcontroller includes an arithmetic logic unit and a controller.

3.

(P35) The AT89S52 microcontroller has 8K×8b Flash ROM memory, and can be expanded externally to a maximum of 64KB of program memory for storing program code.

4.

(P35) The AT89S52 microcontroller includes 1 full-duplex asynchronous serial communication interface (UART), which has 4 operating modes, allowing for one-to-one single machine serial communication, one-to-many multi-machine serial communication, and can also be used to expand parallel I/O interfaces.

5.

(P35) The AT89S52 microcontroller has a total of 32 special function registers (SFR), with unit address mapping in the internal RAM, used for the CPU to manage, control, and monitor internal peripheral components.

6.

(P40) The arithmetic logic unit (ALU) is the execution component for performing arithmetic operations, logical operations, and bit operations, mainly including the arithmetic logic unit (ALU), accumulator A, program status word register (PSW), register B, and temporary registers.

7.

(P42) The program memory is used to store edited and debugged programs and constant data tables, allowing the microcontroller to execute instructions sequentially according to the pre-programmed instructions to complete designated functions.

8.

(P43) After the reset of the AT89S52 microcontroller, PC=0000H, generally, an absolute jump instruction is stored at address 0000H, directing to the main program address to execute the main program.

9.

(P55) In the AT89S52 microcontroller, if a 6MHz crystal oscillator is used, then one machine cycle is 2μs.

10.

(P55) One machine cycle of the AT89S52 microcontroller equals 12 clock oscillation cycles.

11.

(P41) If the content of A is 65H, then the value of the P flag is 0.

12.

After the reset of the AT89S52 microcontroller, the address of the storage unit corresponding to R3 is 03H, (P46) because at power-up PSW=00H, (P41, P43) so the current working register area is 0 group of working registers.

13.

(P58) When the AT89S52 microcontroller is reset, the pins of ports P0~P3 are at high level.

14.

(P55) The AT89S52 microcontroller uses an external oscillator as the clock signal, with pin XTAL1 connected to the clock, and pin XTAL2 is left unconnected.

15.

(P47) When calling a subroutine through stack operations, the content of PC must first be pushed onto the stack for breakpoint protection. When returning from the subroutine call, the stack must be popped to restore the protected breakpoint back to PC, with the original content of PC being popped first.

2. Multiple Choice Questions

1.

(P35) The AT89S52 microcontroller includes 3 programmable ____-bit timers/counters, which can be used for internal timing and external event counting.

A. 8 B. 4 C. 16 D. 32

2.

(P58) Applying a high level lasting longer than ____ on the RST pin can reset the AT89S52 microcontroller.

A. 2 machine cycles of high level B. 2 machine cycles of low level

C. 1 machine cycle of high level D. 1 machine cycle of low level

3.

(P50~51) When the AT89S52 microcontroller expands external memory and I/O interface chips, ports P0 and P2 provide ____ addresses respectively.

A. high 4 bits, low 12 bits B. low 12 bits, high 4 bits

C. high 8 bits, low 8 bits D. low 8 bits, high 8 bits

4.

(P42) During program execution, the current value of PC is ____.

A. the address of the currently executing instruction

B. the address of the next instruction to be executed

C. the address of the previous instruction being executed

D. the address in the instruction register (IP)

5.

(P47) The reset value of SP is 07H, and after system initialization, the SP pointer always points to ____.

A. 07H unit B. 08H unit C. stack bottom D. stack top

Note: Additional multiple choice questions on the learning platform have already appeared in the fill-in-the-blank questions and will not be repeated.

3. Short Answer Questions

1.

(P35) What is the function of the “watchdog” timer?

The watchdog timer (WDT) of the AT89S52 microcontroller is used to monitor the operation of the program. When the microcontroller application system is disturbed, causing the program to “run away” or enter a “dead loop” state, the watchdog will reset the system, restarting the program execution from address 0000H.

2.

(P37) What is the function of the ALE pin?

ALE is the address latch enable signal. When the CPU accesses external program memory or external data memory, ALE provides the address latch signal, latching the low 8 bits of the address in the external address latch. During normal operation of the microcontroller, the ALE pin continuously outputs a positive pulse signal, with a frequency of 1/6 of the clock oscillation frequency fOSC, which can be used as an external timing or trigger signal.

3.

(P38) Briefly describe the difference between connecting the EA pin to high and low levels on the AT89S52 microcontroller.

When the EA pin is at a high level, if the PC value does not exceed 1FFFH (i.e., does not exceed the address range of the internal 8KB Flash memory), the AT89S52 microcontroller executes the instruction code from the internal program memory (8KB); however, when the PC value exceeds 1FFFH (i.e., exceeds the address range of the internal 8KB Flash), it will automatically switch to read the instruction code from the external 56 KB (2000H~FFFFH) program memory space.

When the EA pin is at a low level, only the instruction code from the external program memory is read, with addresses from 0000H~FFFFH, at which point the internal 8KB Flash program memory is inactive.

4.

(P47) Briefly describe the concept and function of the stack.

In the internal RAM, a dedicated area is often set aside to store certain special data, following the “first in, last out” (FILO) rule; this RAM area is called the stack. The stack is mainly established for program calls and interrupt operations, with the following main functions:

a.

Breakpoint protection: When calling a subroutine or interrupt service subroutine, the CPU saves the current PC value (breakpoint address) onto the stack, and upon return, the CPU automatically pops the PC value.

b.

Context protection/restoration: When calling a subroutine or interrupt service subroutine, the CPU must push the contents of relevant registers from the main program onto the stack to avoid overwriting the original contents in the registers during the execution of the subroutine or interrupt service subroutine; this process is called context protection.

5.

(P55) Briefly describe the concept of timing.

Timing refers to the time sequence of control signals issued by the microcontroller when executing instructions; the interrelationship of control signals over time is the CPU’s timing, which consists of a series of pulse signals in a time sequence.

Leave a Comment