1.51 MCU identification information
Usually, the 51 MCU we refer to is the MCU expanded with the 51 core. There are many manufacturers and models of 51 MCU. The following table lists some manufacturers and models of 51 MCU.
The above mentioned MCUs are all MCUs expanded from the 51 core. As long as you learn how to use the 51 MCU, you can basically use all these MCUs. MCUs are all the same, whether it is a 51 MCU or other MCUs, they are all controlled by user programming to achieve certain functions.
The next series of articles will be based on the STC89C516RD+ microcontroller. Below we explain the logo of this microcontroller:
STC—prefix, indicating that the chip is a product produced by STC.
8—Indicates that the chip is a chip with 8051 core.
9—Indicates that the internal memory contains FLASH. For example, 0 in 80C51 indicates that the internal memory contains Mask ROM. For example, 7 in 87C51 indicates that the internal memory contains EPROM (UV-erasable ROM).
C—Indicates that the device is a CMOS product. In addition, LV and LE in 89LV52 and 89LE58 both indicate that the chip is a low-voltage product (usually powered by 3.3V); and 89S52 indicates that the chip contains a FLASH memory with serial download function, that is, it has ISP online programming function.
5—Fixed.
16—Indicates the size of the program storage space inside the chip. 16 is 63KB, and there are also 1 for 4KB, 2 for 8KB, 3 for 13KB, 4 for 16KB, and 8 for 32KB. The size of the program space determines how much execution code a chip can load. Generally speaking, the larger the program storage space, the higher the chip price, so when choosing a chip, we should choose the microcontroller model according to our needs. As long as the program can be loaded, different models of the same chip will not affect its function.
RD+—indicates the internal RAM of the microcontroller. RD+ means the internal RAM is 1280B, and RC means 512B.
2. Introduction to 51 MCU external pins
51 MCU has a variety of packages. The MCU corresponding to this series of articles is a 40-pin PDIP package. The pin diagram of this package is shown in the figure below.
The actual picture of the PDIP packaged microcontroller is shown in the figure below.
In addition, there are 51 MCUs with different pin numbers such as 20, 28, 32, 44, etc. The pin diagram of the MCU in the 44-pin PQFP/LQFP package is shown in the figure below.
The actual picture of the PQFP/LQFP packaged microcontroller is shown in the figure below.
The 44-pin microcontroller also has a PLCC package, and the pin diagram is shown in the figure below.
The actual picture of the PLCC packaged microcontroller is shown in the figure below.
Although the packages and pin definitions of the MCU are different, they are only different in external form. The internal structure and usage are the same. Next, we will take the PDIP packaged MCU as an example to explain the pins of the MCU.
VCC (pin 40), VSS (pin 20) - the power pins of the microcontroller. Different types of microcontrollers need to be connected to the corresponding power supply voltage. The power supply voltage of the microcontroller on the development board is 5V, and the voltage of the low-voltage microcontroller is 3.3V. When using it, the user should check the chip manual to ensure that the correct voltage is connected.
XTAL1 (pin 19), XTAL2 (pin 18) - external clock pins, XTAL1 is the input of the internal oscillation circuit, and XTAL2 is the output of the internal oscillation circuit. There are two ways to use the clock of 8051. One is the internal clock oscillation method, which requires an external quartz crystal and an oscillation capacitor to be connected to these two pins. The value of the oscillation capacitor is generally 10pf~30pf; the other is the external clock method, which requires XTAL1 to be grounded, and the external clock signal is input from the XTAL2 pin.
RST (pin 9) - MCU reset pin. When the input is high for more than two consecutive machine cycles, it is valid and used to complete the reset initialization operation of the MCU. After reset, the program counter PC = 0000H, that is, after reset, the first instruction code will be read from the 0000H unit of the program memory. In layman's terms, the MCU executes the program from the beginning.
PSEN (pin 29) - Program memory enable output control terminal. When reading external program memory, PSEN is low level and effective to realize the read operation of external program memory unit. Since the microcontrollers we use now have a large enough ROM inside, almost no one expands the external ROM, so you only need to understand this pin.
ALE/PROG (pin 30) - When the microcontroller expands the external RAM, ALE is used to control the output of the low 8-bit address of the P0 port to be sent to the latch to latch it, so as to achieve the isolation of the low address and data. ALE may be high or low. When ALE is high, the address latch signal is allowed. When accessing the external memory, the ALE signal will jump (i.e., from positive to negative) to send the low 8-bit address signal on the P0 port to the latch; when ALE is low, the content on the P0 port is consistent with the latch output. We will introduce the content of the latch in detail later. When there is no access to the external memory, ALE outputs at a frequency of 1/6 of the oscillation cycle (i.e., 6 divisions), and when accessing the external memory, it outputs at a frequency of 1/12 of the oscillation cycle (i.e., 12 divisions). From here, we can see that when the system is not expanded, ALE will output at a fixed frequency of 1/6 of the oscillation cycle, so it can be used as an external clock or as an external timing pulse. PROG is the input terminal of programming pulse. There is a program memory (ROM) inside the microcontroller, which is used to store the program that the user needs to execute. So how can we store the written program in this ROM? In fact, we write it in through the programming pulse input, and the input port of this pulse is PROG. Now many microcontrollers no longer need programming pulse pins to write programs inside, such as the STC microcontroller we use, which can write programs directly through the serial port, and only needs three lines to connect to the computer. Moreover, the current microcontrollers already have abundant RAM inside, so there is no need to expand RAM, so the ALE/PROG pin is no longer useful.
EA (pin 31) - When EA is connected to a high level, the microcontroller reads the internal program memory. When an external ROM is extended, the external ROM is automatically read after the internal ROM is read. When EA is connected to a low level, the microcontroller directly reads the external ROM. There is no ROM inside the 8031 microcontroller, so when using the 8031 microcontroller, this pin is always at a low level. When the 8751 microcontroller burns the internal EPROM, this pin is used to input a 21V burning voltage. Because the microcontrollers we use now all have internal ROM, this pin is generally always connected to a high level when designing circuits.
I/O port pins—P0, P1, P2 and P3.
P0 port (pin 32~pin 39) - bidirectional 8-bit three-state I/O port, each port can be controlled independently. There is no pull-up resistor inside the P0 port of the 51 microcontroller, and it is in a high-impedance state, so it cannot output high/low levels normally. Therefore, this group of I/O ports must be connected to an external pull-up resistor when in use. Generally, we choose to connect a 10k ohm pull-up resistor.
P1 port (pin 1 to pin 8) - quasi-bidirectional 8-bit I/O port, each port can be controlled independently, with internal pull-up resistors. This interface output does not have a high-impedance state, and the input cannot be latched, so it is not a true bidirectional I/O port. The reason why it is called "quasi-bidirectional" is that before the port is used as an input, it must first be written to the port, and then the microcontroller can correctly read the external signal, that is, it must have a "preparation" process first, so it is called a quasi-bidirectional port. The second function of the microcontroller P1.0 pin is the external input of the T2 timer/counter, and the second function of the P1.1 pin is the T2EX capture and reload trigger, that is, the external control terminal of T2.
P2 port (pin 21~pin 28)—quasi-bidirectional 8-bit I/O port, each port can be controlled independently, with built-in pull-up resistors, similar to P1 port.
P3 port (pin 10 to pin 17) - quasi-bidirectional 8-bit I/O port, each port can be independently controlled, with internal pull-up resistors, when used as the first function, it is used as a normal I/O port, similar to P1 port, when used as the second function, the definition of each pin is shown in the following table. It is worth emphasizing that each pin of P3 port can be independently defined as the first function input/output or the second function.
The second function definition of P3 port
Previous article:51 Single Chip Microcomputer (Part 2) - How to burn 51 single chip microcomputer program
Next article:Microcontroller Learning Notes 2---Debugging Digital Tube Circuit
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- Overvoltage and overcurrent protection circuit of power supply
- TI can solve common problems of high-precision ultrasonic flow measurement at low flow rates
- Javascript Smart Watch
- Introduction to Zigbee communication technology transmission distance and wall penetration capability
- 51 single chip microcomputer
- HyperLynx High-Speed Circuit Design and Simulation (XI) Quantitative Analysis of Signal Overdrive and Underdrive
- TI seems to have a DCDC switching power supply verification platform, which is controlled by DSP and can achieve voltage boost or voltage reduction by controlling different NMOS.
- Data丨Xunwei IMX6ULL development board-main frequency and clock configuration routine (Part 2)
- Problems still occur after installing AD16
- [Environmental Expert's Smart Watch] Part 6: BLE broadcast temperature, humidity and air pressure data