# 51 MCU Minimum System Board

### 51 Microcontroller Minimum System Schematic

I am a microcontroller engineer, the following explanation you refer to .

.

The 51 microcontroller has 40 pins. The following is the minimum system schematic, is to rely on these four parts, the microcontroller can run up. (Look at the number markers below, 1234)

.

.

Let’s explain:

1 Part 1: The power pack (the part marked 1)

.

40 feet connected to the power supply 5V (upper right),

20 feet connected to the negative side of the power supply (lower left),

Inside the microcontroller, the negative side can also be called GND or “ground”,

We are used to say that the negative side of the microcontroller application for the “ground”,

We have to say that the negative side is the “ground”.

We are accustomed to calling the negative terminal “ground” in microcontroller applications, and the above GND is an abbreviation for English ground, which translates to the meaning of “ground”.

.

.

2 The second part: the crystal set (marked as part of the 2)

.

11.0592M crystal oscillator Y1 and the microcontroller’s 18, 19 pins in parallel, because these two pins, is the crystal oscillator’s working pins.

22p capacitor C2 one end of the 18 feet, one end of the ground.

22p capacitor C3 one end of the 19 feet, one end of the ground.

The two capacitors, we choose between 10 ~ 30P are available, the main role is to filter out the high-frequency signals of the crystal part of the work of the crystal more stable.

.

.

3 third part: the reset group (marked as part of the 3)

10u capacitor C1 positive terminal connected to the power supply 5V, C1 negative terminal connected to the microcontroller reset foot, the ninth foot.

1K resistor R17 is connected to the reset pin of the microcontroller at one end and grounded at the other end.

It is through this 10u and 1k, you can let the microcontroller at the beginning of the power supply, the microcontroller automatically reset, from zero to start executing the program, this is the concept of reset.

.

.

4 Part IV: Other Function Groups (Marked as part of 4)

This foot is the memory selection foot, when this foot is connected to “ground”, then it is to tell the microcontroller to select the use of external memory, when this foot is connected to “5V”, then it is to tell the microcontroller to select the use of external memory, when this foot is connected to “5V”, it is to tell the microcontroller to select the use of external memory. When this pin is connected to “5V”, it indicates that the microcontroller uses internal memory.

If you choose an external memory, it’s a waste of the microcontroller’s only resources, so this pin is always connected to the power supply 5V (as shown above), using the microcontroller’s internal memory.

5 If the internal memory is not enough capacity, up to select a more advanced capacity, you can solve the problem of insufficient capacity, it is so simple

.

Beginning 51 microcontroller in a day: click me to learn

.

I am Brother Age, may you enjoy learning!

### 51 microcontroller minimum system schematic?

The microcontroller’s minimum system is composed of a number of components necessary to form the microcontroller system, in addition to the microcontroller, but also need to include the power supply circuit, clock circuit, reset circuit. Microcontroller minimum system circuit (microcontroller power supply and ground is not marked) as shown in Figure 2-7.x0ax0a Figure 2-7 microcontroller minimum system x0a The following focus on the clock circuit and reset circuit.x0a1) Clock Circuit x0a microcontroller work, from the fetch command to decode and then micro-operation, must be controlled by a clock signal to be carried out in an orderly manner, the clock circuit is to provide a basic clock for the work of the microcontroller. The clock circuit is to provide the basic clock for the microcontroller work. The clock signal of the microcontroller usually has two ways of generating: internal clock mode and external clock mode. x0a The principle circuit of the internal clock mode is shown in Figure 2-8. A crystal and two frequency stabilizing capacitors are connected across the XTAL1 and XTAL2 pins of the microcontroller to form a stable self-excited oscillator with the microcontroller’s on-chip circuitry. The value range of the crystal oscillator is generally 0~24MHz, and the commonly used crystal oscillator frequencies are 6MHz, 12MHz, 11.0592MHz, 24MHz and so on. Some newer microcontrollers can also choose a higher frequency. The role of the external capacitor is to fine-tune the frequency of the oscillator, so that the oscillating signal frequency and the crystal frequency is the same, at the same time play a role in stabilizing the frequency, the general selection of 20-30pF ceramic capacitors. x0a external clock mode is in the microcontroller XTAL1 pin on the external source of a stable clock signal, which is generally applicable to the simultaneous operation of multi-chip microcontrollers, the use of the same clock signal can ensure that The same clock signal can ensure the synchronization of the work of the microcontroller. x0a Timing is a microcontroller in the execution of instructions issued by the CPU control signals in the sequence of time. x0a Oscillation cycle: is an on-chip oscillation circuit or off-chip for the microcontroller to provide the cycle of the pulse signal. x0a Oscillation cycle: is an on-chip oscillation circuit or off-chip for the microcontroller to provide the pulse signal. x0a Oscillation cycle: is an on-chip oscillation circuit or off-chip for the microcontroller to provide the pulse signal. 1 oscillation cycle in the timing is defined as 1 beat, expressed as P. x0a Clock cycle: the oscillation pulse is fed into the internal clock circuit, and the clock pulse period output by the clock circuit after dividing it by two is called the clock cycle. The clock period is two times the oscillation period. 1 clock cycle in the timing sequence is defined as 1 state, denoted by S. Each state consists of 2 beats, denoted by P1, P2. x0a Machine Cycle: A machine cycle is the time required for a microcontroller to complete a basic operation. The execution of an instruction takes one or several machine cycles. A machine cycle is fixed and consists of 6 states S1~S6. x0a Instruction Cycle: The time required to execute an instruction is called an instruction cycle. Generally expressed in terms of the number of machine cycles required for the execution of the instruction. x0a The execution of most of the instructions of the AT89C51 microcontroller requires one or two machine cycles, and only the execution of the multiplication and division of two instructions requires four machine cycles. x0a After understanding the concepts of the above timings, we can quickly calculate the time required for the execution of an instruction. x0a If we use a 12-bit instruction, the instruction cycle time can be calculated as follows. For example, if the microcontroller uses a 12MHz crystal frequency, the oscillation period = 1/(12MHz) = 1/12us, the clock period = 1/6us, and the machine cycle = 1us, the execution of a single-cycle instruction requires only 1us, and the execution of a double-cycle instruction requires 2us.x0a2) Reset Circuitx0a Either at the beginning of the microcontroller is connected to the power supply, or in the process of operation A reset is required both when the microcontroller is first connected to the power supply and when a fault occurs during operation. The reset circuit is used to restore the state of the internal circuits of the microcontroller to a definite initial value and to start working from this state. x0a Reset condition of the microcontroller: it must be able to make its RST pin continuously high for two (or more) machine cycles. x0a Reset form of the microcontroller: power-on reset, key reset. x0a Power-on reset, key reset. The power-up reset and key reset circuits are as follows. x0ax0a Figure 2-9 Microcontroller Reset Circuit x0a In the power-up reset circuit, capacitor charging is utilized to achieve reset. The potential on the RST pin is high (Vcc) at the instant the power is turned on, and the capacitor is rapidly charged after the power is turned on, and as the charging proceeds, the potential on the RST pin drops to a low level. As long as the time to ensure that the high level on the RST pin is greater than two machine cycles, a normal reset can be realized. x0a key reset circuit, when the key is not pressed, the circuit is the same as the power-on reset circuit. If the RESET key is pressed during the operation of the microcontroller, the capacitor that has been charged will be quickly discharged through the circuit of 200Ω resistor, thus making the potential on the RST pin quickly become high, and this high level will be maintained until the key is released, thus meeting the conditions of microcontroller reset to achieve key reset. x0a The reset values of the special function registers after microcontroller reset are shown in Table 2-11. x0a Table 2-11 Microcontroller Special Function Register Reset Values x0a Register Reset Value Register Reset Value Register Reset Value x0aPC0000HSBUF Uncertain TMOD00Hx0aB00HSCON00HTCON00Hx0aACC00HTH100HPCON0*** 0000Bx0aPSW00HTH000HDPTR0000Hx0aIP***00000BTL100HSP07Hx0aIE0**00000BTL000HP0~P3FFHx0a Note: * denotes irrelevant bits.

### 51 Microcontroller Minimum System

The following is a detailed description of each part 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 microcontroller:

XTAL1 (19 pins): the chip’s internal oscillation circuit 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. The internal clock mode is used in Figure 2, where an internal oscillator is used to generate self-excited oscillations by utilizing the chip’s internal oscillator circuitry, with external timing elements (a quartz crystal and two capacitors) on the pins of XTAL1 and XTAL2. Generally speaking, the crystal oscillator can be selected from 1.2 to 12MHz, or even up to 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 using quartz crystal, capacitance can be selected between 20 to 40pF (30pF for this kit); when using ceramic resonant devices, capacitance should be increased appropriately, between 30 to 50pF. Usually a 33pF ceramic capacitor is sufficient.

It is also worth mentioning that if the readers themselves in the design of 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 leads, to ensure that the oscillator works reliably. Detect whether the crystal oscillator vibration method can be used to oscilloscope can be observed XTAL2 output a very beautiful sine wave, you can also use a multimeter to measure (the block to the DC block, this time measured is the RMS value) XTAL2 and the ground voltage between the voltage, you can see a little bit of voltage around 2V.

2. Reset circuit

In the microcontroller system, the reset circuit is very critical, when the program runs (not running properly) or dead (stop running), it needs to be reset.

The reset pin RST (pin 9) of the MCS-5l series microcontroller performs a reset when it goes high for more than 2 machine cycles. If RST is continuously high, the microcontroller is in a cyclic reset state.

The reset operation usually takes two basic forms: automatic power-on reset and switch reset. The reset circuit shown in Figure 2 includes these two reset methods. Power-on moment, the capacitor voltage can not be changed abruptly, at this time the negative pole of the capacitor and RESET is connected, the voltage is all added to the resistor, the input of RESET is high, the chip is reset. With the +5V power supply to the capacitor charging, 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 measurement, in order to ensure that the reset circuit of the microcontroller is reliable.

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 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 or not.

For the vast majority of today’s microcontrollers, the internal program memory (generally flash) is very large, so basically there is 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. This must be noted that many beginners often leave the EA pin dangling, which leads to improper program execution.

4. P0 port external pull-up resistor

51 microcontroller P0 port for open-drain output, 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, an external pull-up resistor must be connected.

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, latch Q = 0, Q = 1, the field effect tube V1 open, the port line is a low-level state. At this time, regardless of whether the external signal on the port line is low or high, the signal read from the pin into the microcontroller is low, and thus can not correctly read the signal on the port pin. 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, in the input data before, should be written to the P0 port “1”, at this time, the Q end 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, before the high resistance input. The output stage 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 input data read error, need to be connected to the external pull-up resistor. In this experimental kit is used to add a 10K row resistance. In addition, the 51 microcontroller in 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 field effect tube cut-off, 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 field effect tube is cut off.

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 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 LED is used here. Second, 51 microcontroller (such as the STC89C52 microcontroller used in this experimental board), the I / O port as the output port, the ability to pull the current (output current to the outside) is the level of μA, 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, Figure 2 in the resistor R1 for 1K resistance, is to limit the current, so that the operating current of the light-emitting diode is limited to 2mA ~ 10mA.

### 51 microcontroller minimum system has which several circuits each circuit role

51 microcontroller minimum system includes the following circuits:

1, power supply circuit: for the system to provide the required power supply energy;

2, crystal oscillator circuit: for the work of the system to provide the clock beats, that is, the clock cycle, like the human heart.

3, reset circuit: reset the system.