Study Notes - 51 MCU Minimum System Construction

Publisher:EtherealGlowLatest update time:2022-05-17 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The minimum system of a single-chip microcomputer, or the minimum application system of a single-chip microcomputer, refers to a system that can work with a single-chip microcomputer composed of the least components. For the 51 series single-chip microcomputer, the minimum system should generally include: single-chip microcomputer, crystal oscillator circuit, reset circuit.


1. Let's talk about the pins of 51 single chip microcomputer:

51 MCU pin distribution diagram

Bus type DIP40 pin package

Power and clock pins, 4

VCC: power supply pin

VSS: Ground pin

XTAL1: A pin to which the crystal oscillator is connected

XTAL2: Another pin to which the crystal oscillator is connected

Control line pins, 4

RST/VPD: reset signal input pin/backup power input pin; ALE/PROG: address latch enable signal output pin/programming pulse input pin

EA/VPP: Internal and external memory selection pin. When connected to a high level, the microcontroller starts executing from 0000H of the internal ROM after reset; when connected to a low level, it starts executing directly from 0000H of the external ROM after reset.

PSEN: External program memory select signal output pin

Parallel I/O pins, 32, divided into 4 8-bit ports

P0.0 ~ P0.7: General I/O port pins or data/low address bus multiplexing pins

P1.0 ~ P1.7: General I/O port pins

P2.0 ~ P2.7: General I/O port pins or high address bus pins

P3.0 ~ P3.7: General I/O port pins or second function pins


2. The following is a minimum system circuit diagram of a 51 single-chip microcomputer built in the proteus environment. Proteus software is an EDA tool software published by Labcenter electronics in the UK. It can mainly simulate single-chip microcomputers and peripheral devices. In terms of compilation, it also supports multiple compilations such as IAR, Keil and MATLAB.

The minimum system of 51 single chip microcomputer

Crystal oscillator circuit:

There are crystal oscillators in the microcontroller system. The crystal oscillator plays a very important role in the microcontroller system. The full process is called a crystal oscillator. It combines with the internal circuit of the microcontroller to generate the clock frequency required by the microcontroller. The higher the clock frequency provided by the microcontroller crystal oscillator, the faster the microcontroller runs. The typical crystal oscillator takes 11.0592MHz (convenient for serial port baud rate setting) or 12MHz (produces accurate uS-level pauses, convenient for timing operations). The capacitor here is 22pf (15~33pF is fine, empirical value), and the closer the capacitor is to the crystal oscillator, the better. The closer the crystal oscillator is to the microcontroller, the better. Ceramic chip capacitors or non-polar chip capacitors are selected according to the type of circuit board being manufactured.


Reset circuit:

When the microcontroller system is running and the program runs away due to environmental interference, press the reset button and the internal program will automatically start from the beginning. To reset the 51 microcontroller, just connect a high level to the RST pin for 2 US.


The working principle of the reset circuit is as follows:

In the circuit diagram, the size of the capacitor is 10uF and the size of the resistor is 10k. According to the formula, it can be calculated that the time required for the capacitor to charge to 0.7 times the power supply voltage (the power supply of the microcontroller is 5V, so charging to 0.7 times is 3.5V) is 10K*10UF=0.1S. That is to say, within 0.1S of the computer startup, the voltage across the capacitor increases from 0~3.5V. At this time, the voltage across the 10K resistor decreases from 5~1.5V (the sum of the voltages at each point in the series circuit is the total voltage). Therefore, within 0.1S, the voltage received by the RST pin is 5V~1.5V. In the 51 microcontroller that works normally at 5V, a voltage signal less than 1.5V is a low-level signal, and a voltage signal greater than 1.5V is a high-level signal. Therefore, within 0.1S of startup, the microcontroller system automatically resets (the high-level signal time received by the RST pin is about 0.1S). It will also reset when the button is pressed. After the microcontroller starts for 0.1S, the voltage across the capacitor C is continuously charged to 5V. At this time, the voltage across the 10K resistor is close to 0V, and RST is at a low level, so the system works normally. When the button is pressed, the switch is turned on. At this time, a loop is formed across the capacitor, and the capacitor is short-circuited. Therefore, during the process of pressing the button, the capacitor begins to release the previously charged electricity. As time goes by, the voltage of the capacitor is released from 5V to 1.5V or even smaller within 0.1S. According to the series circuit voltage being the sum of all points, the voltage across the 10K resistor is 3.5V or even larger at this time, so the RST pin receives a high level again. The microcontroller system automatically resets.


Download Circuit:

  We can connect P3.0 (RXD), P3.1 (TXD) and the power ground to a 3p header to facilitate program downloading and serial port communication.


3. Finally, let's briefly talk about the output drive capability of the microcontroller:

  The pins of the microcontroller can be controlled by the program to output high and low levels. When the microcontroller outputs a low level, it will allow external devices to inject current into the microcontroller pins. This current is called "sinking current" and the external circuit is called "sinking current load". When the microcontroller outputs a high level, it allows external devices to pull current from the microcontroller pins. This current is called "pulling current" and the external circuit is called "pulling current load". When each single pin outputs a low level, the maximum current allowed to be injected into the pin by the external circuit is 10 mA; each 8-bit interface (P1, P2 and P3) allows a maximum total current of 15 mA to be injected into the pin, while P0 has a stronger ability and allows a maximum total current of 26 mA to be injected into the pin; the sum of the maximum current allowed by all four interfaces is 71 mA. When these pins "output a high level", the "pulling current" capability of the microcontroller can be said to be too poor, less than 1 mA. The conclusion is: when the microcontroller outputs a low level, the driving capability is acceptable, but when it outputs a high level, it has no ability to output current. When designing the load circuit of the microcontroller, the circuit form of "current sinking load" should be used to avoid unnecessary current consumption. So here we use the "current sinking" method to connect an LED lamp. At this point, a minimum system of a 51 microcontroller is built, and the journey of learning microcontrollers begins~~~

  Attached is a small program to control the flashing of an LED through P1.0


#include

sbit led=P1^0;

void delay(unsigned int i)

{

    unsigned int j;

    unsigned char k;

    for(j=i;j>0;j--)

        for(k=125;k>0;k--);

}

void main(void)

{

    while(1)

    {   

        led=~led;          

        delay(2000);    

    }

}

Reference address:Study Notes - 51 MCU Minimum System Construction

Previous article:Study Notes - 51 MCU Serial Communication
Next article:Study Notes - 51 MCU Special Function Registers

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号