[Basics of single chip microcomputer] (3) MCU structure

There are many specific models of MCS-51 series microcontrollers, such as 8031, 8051, 8751, 8032, 8052 produced by Intel and AT89C51, AT89S51 produced by Atmel, etc., all belong to the MCS-51 series. The internal composition of MCS-51 series MCU is basically the same, as shown in Figure 2-1.

It can be seen from Figure 2-1 that the MCU is mainly composed of CPU, clock oscillator, interrupt controller, program memory (ROM), random access memory (RAM), two timers/counters, serial communication ports, input / Output (I/O) Interface and bus controller.

1. The CPU (central processing unit) is the core component of the single-chip microcomputer, which determines the main functions and characteristics of the single-chip microcomputer. When working, the CPU calls the program from the ROM and performs calculations, and then sends a control signal to the I/O interface via the bus, and then the I/O interface sends the control signal to the peripheral output circuit.
2. The function of the clock oscillator is to generate a clock signal and send it to the internal circuits of the single-chip microcomputer, and to control these circuits to make them work in a rhythm. The higher the clock signal frequency, the faster the internal circuit works.
3. When the CPU is executing a normal program, if an interrupt request signal (usually a low-level signal) is sent to the interrupt controller at the INT0 or INT1 terminal, the interrupt controller will immediately let the CPU stop the program being executed, and then go Execute a specific program in the ROM, and then continue to execute the previously interrupted program after the program is executed. The MCS-51 series MCU interrupt controller can accept 5 interrupt requests: two external interrupt requests, two timer/counter interrupt requests and serial communication port interrupt requests.
4. ROM (read-only memory, also known as program memory) is a circuit with storage function, the information in it will not disappear after power off. ROM is mainly used to store program codes. To make the single-chip microcomputer complete different control functions, different programs can be written into the ROM. When working, the CPU will automatically read the program from the ROM and perform calculations, and then output the corresponding control signal to the external circuit through the I/O interface. In the early days, ROM was generally a separate chip, which was not integrated in the microcontroller (for example, there is no ROM inside the 8031 ​​microcontroller, and it needs to be connected externally). The current microcontrollers basically integrate the ROM inside.
5. RAM (random access memory, also known as readable and writable memory, data memory) is also a kind of storage circuit. The characteristics of RAM are: it can store information (called writing), or take out information (called reading), and all the stored information will disappear after the power is off. The RAM of the microcontroller is mainly used to store some temporary data.
6. The timer/counter is like the internal clock or counter of the microcontroller, and it can be set as a timer or counter as needed. If the CPU is required to execute a certain program after a period of time (such as 5ms), the timer/counter can be made to work in the timing state, and the timer/counter will start timing. When 5ms is counted, a request signal will be generated immediately and sent to the interrupt controller. The interrupt controller outputs a signal to let the CPU stop the program being executed, and instead execute a certain section of the program in the ROM.
If the timer/counter is working in the counting state, a pulse signal can be input from the T0 or T1 terminal, and the timer/counter starts to count the input pulses. When the count reaches a certain value, it immediately outputs a signal to the interrupt controller. Let the interrupt controller control the CPU to execute a specific program in the ROM.
7. The serial communication port is the interface for serial communication between the microcontroller and external devices. When the microcontroller wants to transmit data to an external device, the data can be output from the TXD terminal through the serial communication port; the data sent by the external device can be input from the RXD terminal, and the data is sent to the microcontroller through the serial communication port.
Serial refers to a method of data transmission. When serially transmitting data, the data is transmitted bit by bit.
8. MCS-51 series single-chip microcomputer has 4 groups of I/O interfaces, which are P0, P1, P2 and P3 ports. The microcontroller is connected to external devices through these ports. These 4 groups of ports are all multiplexed ports, which can be used as output ports or input ports. The specific port is determined by the internal program of the microcontroller.
When these ports are used as input ports, input components such as keyboards, various sensors and detection switches can be connected; if used as output ports, they can be connected to output components such as light-emitting diodes and relays.
When the single-chip microcomputer is working, the input component sends the input signal into the internal through the input port, and the CPU executes the relevant program in the ROM according to the input signal, and then outputs the control signal from the output port to control the operation of the output component.
9. The single-chip microcomputer uses ROM to store the written programs, but the internal ROM capacity is usually small and can only store some uncomplicated programs. If you encounter some large and complex programs, which occupy a large capacity, the internal ROM of the single-chip microcomputer will It cannot be installed completely. The solution to this problem is to use an external memory. The bus controller is mainly used to control the external memory, so that it can be used like the internal memory of the microcontroller.

Guess you like

Origin blog.csdn.net/wsq_666/article/details/113523721