Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.
First of all, you should understand the minimum system of 51 MCU: 51 minimum system is also called 51 minimum application system, which refers to the system that 51 MCU can work with the least components. As shown in Figure 2.1.1, the 51 minimum system should generally include: microcontroller, crystal oscillator circuit, reset circuit.
The principle and composition of the crystal oscillator circuit, the role:
In the single-chip system, the role of the crystal oscillator is very large. He combines the internal circuit of the single-chip microcomputer to generate the clock frequency necessary for the single-chip microcomputer. The execution of all the instructions of the single-chip microcomputer is based on this. The higher the clock frequency provided by the crystal oscillator, The faster the microcontroller will run. Simply put, without a crystal oscillator, there is no clock cycle, no clock cycle, the program code cannot be executed, and the microcontroller cannot work. When the microcontroller is working, the instructions are taken from the RoM one by one, and then executed step by step. The time that the microcontroller accesses the memory is called a machine cycle, which is a time base. A machine cycle consists of 12 clock cycles. If a single 12MHz crystal is selected, its clock period is 1/12us, and its one machine cycle is 12&TImes; (1/12)us, which is 1us.
Composition: crystal, load capacitance, internal circuit
Principle: Quartz crystal oscillator (referred to as crystal oscillator) provides time for the MCU through vibration. With time, there is timing, and the program can be run without errors. Generally, the 51 minimum system uses a 12MHZ crystal oscillator, which is more than the internal clock 6MHZ. A lot more precise. The crystal oscillator operates in a resonant state with a crystal that converts electrical energy and mechanical energy into each other to provide stable, accurate single-frequency oscillation. It's like bringing a clock to a microcontroller. Two 30pF capacitors. It plays a role of vibration and resonance. The values of the two capacitors are the same, or the phase difference is not large. If the phase difference is too large, the resonance imbalance is easily caused, and it is easy to cause the vibration to stop or simply not vibrate.
There is a high-gain inverting amplifier (or oscillator) whose input is chip pin XTAL1 and its output is pin XTAL2. On the outside of the chip, the crystal oscillator and trimming capacitor are connected between XTAL1 and XTAL2 to form a stable self-excited oscillator, which is the clock circuit of the microcontroller.
The principle and function of the reset circuit:
The reset circuit is a circuit device used to restore the circuit to its initial state. General: Power-on reset; connect a capacitor to the VCC terminal on the RST reset input pin, and connect a resistor to the ground.
Principle: The role in the control system is to start the microcontroller to start working. However, when the power is turned on and the voltage is abnormal or interfered during normal operation, the power supply may have some unstable factors, which may have a serious impact on the stability of the operation of the microcontroller. Therefore, the delay output to the chip outputs a reset signal when the power is turned on. Another function of the upper reset circuit is to monitor the supply voltage during normal operation. If the power supply is abnormal, a forced reset will be performed. The reset output pin outputs a low level for three (12/fc s) or more instruction cycles, and the reset program begins to initialize the initial state inside the chip. Waiting to accept the input signal.
Why do you have to use low-frequency LED lighting?
Since the structure of the I/O port of the MCU determines that it has a high current sinking capability, it uses a low-level LED. Generally, the LED is illuminated at a low level, which has a certain anti-interference effect. Because the output capability of the MCU is limited, if the pin outputs a high level to drive the device, even if there is a pull-up resistor, the operation state of the MCU will be unstable. In fact, using a low-level LED can simplify the design of the MCU interface. If the interface component is used, the high-level drive and the low-level drive have the same effect. In addition, the low-level drive also simplifies the control code, avoiding the influence of the high-level switch on the LED after the power-on reset of the microcontroller. .
Need to pay attention to:
The reason why the while(1) statement in the program can be executed after being removed is because: in the following program, there is already LED=0, which means that the LED is driven low.
So even if it is removed, it can be executed.
After the last circuit diagram is drawn. Protues can indeed be lit on the emulation software. But in fact this is not achievable. Mainly because the io port EA selects the input for the off-chip program memory. When this pin is low, the off-chip program memory is used. When it is high, the on-chip program memory is used. So need to put this port on the street power. Give it access to the on-chip program memory
Письмо этому поставщику
Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.
Fill in more information so that we can get in touch with you faster
Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.