51 microcontroller minimum system?
Microcontroller minimum system, or known as the minimum application system, refers to the use of the minimum number of components composed of microcontrollers can work system. For the 51 series of microcontrollers, the minimum system should generally include: microcontroller, power supply, crystal circuit, reset circuit.
1, microcontroller
89C51 microcontroller a
2, power supply
5V DC power supply 1
3, crystal circuit
including 12MHz crystal 1, 30pF ceramic capacitors 2
4, reset circuit
10uF electrolytic capacitors 1, 4k7 resistor 1. 1 x 4k7 resistor.
The circuit is as follows:
Turn left|Turn right
Note: The /EA (pin 31) in the above figure can also be directly connected to the power supply VCC, 2k resistor can be removed.
51 microcontroller minimum system:
1, clock circuit 51 microcontroller on the clock pins: XTAL1 (19 pins): chip internal oscillator circuit input. XTAL2 (18 feet): the chip’s internal oscillator circuit output.
2, reset circuit In the microcontroller system, the reset circuit is very critical, when the program runs (not running normally) or dead (stop running), it is necessary to reset. MCS-5l series microcontroller reset pin RST (pin 9) appears more than 2 machine cycles of high level, the microcontroller performs a reset operation. If RST is continuously high, the microcontroller is in a cyclic reset state.
3, EA/VPP (31 pins) function and connection 51 microcontroller EA/VPP (31 pins) is the internal and external program memory selection pin. When EA stays high, the microcontroller accesses the internal program memory; when EA stays low, it only accesses the external memory regardless of whether there is an internal program memory.
What is the minimum system of a 51 microcontroller?
The minimum system of a microcontroller, or minimum application system, is a system that can work with a microcontroller composed of a minimum number of components.
For a 51 series microcontroller, the minimum system should generally include: a microcontroller, a crystal circuit, and a reset circuit.
51 microcontroller minimum system schematic diagram:
51 microcontroller minimum system circuit introduction:
1.51 microcontroller minimum system reset circuit polarity capacitance C1 size directly affects the reset time of the microcontroller, generally 10 ~ 30uF, 51 microcontroller minimum system capacitance value the larger the reset time needed to be shorter.
2.51 microcontroller minimum system crystal Y1 can also be used 6MHz or 11.0592MHz, in the case of normal operation can be used at a higher frequency crystal, 51 microcontroller minimum system crystal oscillation frequency directly affects the processing speed of the microcontroller, the greater the frequency of the faster processing speed.
3. 51 microcontroller minimum system starting capacitance C2, C3 generally 15 ~ 33pF, and capacitance from the crystal closer to the better, the crystal from the microcontroller closer to the better 4. P0 port is open-drain output, as the output port needs to be added to the pull resistor, the value is generally 10k.
Set to the timer mode, the plus 1 counter is the counting of the internal machine cycle (1 machine cycle is equal to 12 oscillation cycles), and the counter is the same as the counter. machine cycle is equal to 12 oscillation cycles, i.e. the counting frequency is 1/12 of the crystal frequency). The count value N multiplied by the machine cycle Tcy is the timing time t.
MCS-51 microcontroller minimum system includes those parts
The following is a detailed description of the microcontroller minimum system circuit shown in Figure 2.
1. Clock Circuit
Before designing the clock circuit, let’s first understand the clock pins on the 51 MCU:
XTAL1 (pin 19): the chip’s internal oscillator input.
XTAL2 (pin 18): the output of the internal oscillator.
XTAL1 and XTAL2 are independent input and output inverting amplifiers that can be configured as on-chip oscillators using quartz crystals, or the devices can be directly driven by an external clock. Figure 2 shows the internal clock mode, where the internal oscillator can generate self-excited oscillations by utilizing the chip’s internal oscillator circuitry and by connecting external timing elements (a quartz crystal and two capacitors) to the pins of XTAL1 and XTAL2. Generally speaking, the crystal oscillator can be selected from 1.2 to 12MHz, or even 24MHz or higher, but the higher the frequency, the higher the power consumption. In this kit, a quartz crystal of 11.0592M is used. The size of the two capacitors connected in parallel with the crystal has a small effect on the oscillation frequency and can play a role in frequency fine-tuning. When the quartz crystal is used, the capacitance can be selected between 20 and 40pF (30pF for this kit); when the ceramic resonator device is used, the capacitance should be increased appropriately, between 30 and 50pF. Usually, a 33pF ceramic capacitor is sufficient.
In addition, it is worth mentioning that if the reader is designing the printed circuit board (PCB) of the microcontroller system, the crystal and capacitor should be as close as possible to the microcontroller chip, in order to reduce the parasitic capacitance of the lead, to ensure that the oscillator works reliably. To detect whether the crystal oscillator is vibrating or not, you can use an oscilloscope to observe a very nice sine wave output from XTAL2, or you can use a multimeter to measure the voltage between XTAL2 and the ground (put the stops to the DC block, and this time, the measured value is the RMS value), and you can see the voltage of about 2V.
2. Reset circuit
In the microcontroller system, the reset circuit is very critical, when the program is running (not running properly) or dead (stop running), you need to reset.
The reset pin RST (pin 9) of the MCS-5l series microcontrollers performs a reset when it is high for more than 2 machine cycles. If RST remains high, the MCU is in a cyclic reset state.
The reset operation usually has two basic forms: automatic power-on reset and switch reset. The reset circuit shown in Figure 2 includes these two types of reset. At the moment of power-on, the voltage at both ends of the capacitor cannot be changed abruptly, at this time, the negative pole of the capacitor and RESET are connected, the voltage is all added to the resistor, the input of RESET is high, and the chip is reset. With the +5V power supply to charge the capacitor, the voltage on the resistor gradually decreases, and finally equal to about 0, the chip works normally. Connected in parallel at both ends of the capacitor for the reset button, when the reset button is not pressed when the circuit to achieve power-on reset, in the normal operation of the chip, by pressing the button to make the RST pin high level to achieve the effect of manual reset. Generally speaking, as long as the RST pin to maintain a high level of more than 10ms, you can make the microcontroller effective reset. The reset resistor and capacitor shown in the figure for the classic value, the actual production can be replaced by the same order of magnitude of the resistor and capacitor, the reader can also calculate their own RC charging time or in the working environment of the actual measurements, in order to ensure that the reset circuit of the microcontroller is reliable.
3. EA/VPP (pin 31) function and connection
51 microcontroller EA/VPP (pin 31) is the internal and external program memory selection pin. When EA is held high, the microcontroller accesses the internal program memory; when EA is held low, it only accesses the external memory regardless of whether there is an internal program memory.
For most of today’s microcontrollers, the internal program memory (usually flash) is very large, so there is basically no need for external program memory, but rather directly use the internal memory.
In this lab kit, the EA pin is connected to VCC and only the internal program memory is used. It is important to note that many beginners often leave the EA pin dangling, which can cause the program to execute incorrectly.
4. P0 external pull-up resistor
The P0 port of the 51 MCU is an open-drain output, and there is no internal pull-up resistor. Therefore, when using it as an ordinary I/O to output data, due to the V2 cutoff, the output stage is an open drain circuit, and in order to make the “1” signal (i.e., high level) output normally, it is necessary to connect an external pull-up resistor.
In addition, to avoid reading data errors during input, external pull-up resistors are also required. Here is a brief explanation of why: In the input state, the signals read from the latch and from the pins are generally the same, but there are exceptions. For example, when the low level output from the internal bus, the latch Q = 0, Q = 1, the field effect tube V1 on, the port line is low. At this time, regardless of whether the external signal on the port line is low or high, the signal read into the microcontroller from the pin is low, and thus the signal on the port pin cannot be read correctly. Another example is that when a high level is output from the internal bus, latch Q = 1, Q = 0, and field effect tube V1 cuts off. If the external pin signal is low, the signal read from the pin is different from the signal read from the latch. Therefore, when the P0 port as a general-purpose I / O interface input, before inputting data, you should write “1” to the P0 port, at this time, the Q terminal of the latch is “0”, so that the output stage of the two field effect tubes V1, V2 are cut off, the pin is in a suspended state, and can be used as a high-resistance input. The output stage of the device can be used as a high resistance input.
To summarize: In order to enable the P0 port in the output can drive the NMOS circuit and to avoid the input read data error, the need for external pull-up resistors. In this lab kit, a 10K resistor is used as an external pull-up. In addition, the 51 microcontroller on the input operation of the port P0-P3, in order to avoid reading errors, should be written to the circuit latch “1”, so that the FET cutoff, in order to avoid the latch for the “0” state on the pin The first step is to write a “1” to the latch in the circuit so that the FET is cut off to avoid the interference of the pin when the latch is “0”.
5. LED driver circuit
Careful readers may have found that the minimum system, light-emitting diode (LED) connection is to take the power supply to the diode positive and then through a 1K resistor connected to the microcontroller I / O port (see Figure 4 in the connection of 1). Why so connected? First of all, we need to know the LED light-emitting operating conditions, different LEDs with different rated voltages and rated currents, in general, red or green color LED operating voltage of 1.7V ~ 2.4V, blue or white color LED operating voltage of 2.7 ~ 4.2V, the diameter of 3mm LED operating current of 2mA ~ 10mA. 3mm red LEDs are used here. Secondly, when the I/O port of 51 microcontrollers (such as the STC89C52 microcontroller used in this experimental board) is used as an output port, the pull current (outputting current to the outside) is at the level of μA, which is not enough to light up a light-emitting diode. And the way to pour current (into the current input) can be as high as 20mA, so the way to pour current to drive the light-emitting diode. Of course, some of today’s enhanced microcontroller, is used to pull the current output (connection 2), as long as the microcontroller’s output current capability is strong enough. In addition, the resistor R1 in Figure 2 is 1K resistance value, in order to limit the current, so that the operating current of the light-emitting diode is limited to 2mA ~ 10mA.
What is included in the minimum system of both 51 microcontrollers and STM32
The minimum system of both 51 microcontrollers and STM32 contains: power supply, clock, reset circuitry, and a simple application circuit.