51 MCU Overview and Design of Minimum System

Publisher:神光骑士Latest update time:2020-06-22 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

What is a microcontroller?

Before learning, you must understand what this thing is, how to use it, and why it can be used in this way. If you understand these three questions, then you can learn the 51 single-chip microcomputer very well.


Comparison of microcontrollers

Here we only compare 8051 and 8052:


Model Flash (ROM) RAM I/O Timer/Counter Interrupt Source Number of Pins

AT89C51 4KB 128B 32 2 5 40

AT89c52 8KB 256B 32 3 8 40


Pin Description

51 single chip microcomputer

20 pin VSS: negative power supply

40-pin VCC: positive power supply (+5V)


Pin 19 XTAL1: Input of the on-chip clock oscillator; when the on-chip clock oscillator is used, this pin is connected to a quartz crystal and a fine-tuning capacitor.

18-pin XTAL2: Output end of the on-chip clock oscillator; when using the on-chip clock oscillator, this pin is connected to a quartz crystal and a fine-tuning capacitor.


Pin 9 RST: Reset signal input terminal; high level is valid (invalid state level must be lower than 0.5V).


31-pin EA/Vpp:

EA=1, access the on-chip program memory, but when the PC (program counter) value exceeds 0FFFH, that is, when it exceeds the 4K byte address range of the on-chip program memory, it will automatically switch to executing the program in the external program memory.


EA=0, the microcontroller only accesses the external program memory

Vpp: When programming the on-chip Flash, this pin is connected to the programming voltage.

Typically, this pin is connected to VCC.


30-pin ALE/PROG:

ALE: Address latch control signal terminal. Not used when not accessing external ROM and RAM.

PROG: programming pulse input terminal.


Pin 29 PSEN: Selection signal of external program memory, low level is valid.


The following are the I/O ports:

P0:

  First function: 8-bit, open-drain bidirectional I/O port. Pull-up resistor is required when in use.

  Second function: The lower 8-bit address line and the 8-bit data line are time-division multiplexed; this is a true bidirectional three-state port.


Power clock, crystal oscillator circuit

1. Internal clock mode

Internal clock

1. The typical value of the starting capacitors C1 and C2 is 15~33pF, and 30pF ceramic capacitors are usually selected.

2. The oscillation frequency of the crystal is generally 12MHz (convenient for timing calculation) and 11.0592MHz (convenient for serial port baud rate setting).

3. Install the crystal and capacitor as close to the microcontroller as possible.


2External clock mode

External clock mode

This method is often used for multiple microcontrollers to work simultaneously.


Timing

1. Clock cycle: The basic time unit of a single-chip microcomputer. If the oscillation frequency of the clock crystal is fosc, then the clock cycle Tosc=1/fosc.

2. Machine cycle: The time required for the CPU to complete a basic operation is called a machine cycle.

The AT89S51 microcontroller has 12 clock cycles as one machine cycle.

Usually, the execution of an instruction is divided into several basic operations, each of which takes one machine cycle.

3. Instruction cycle: The instruction cycle is the time required to execute an instruction.

The instructions of the microcontroller can be divided into single-byte (1 machine cycle), double-byte (2 machine cycles), and three-byte instructions (3 machine cycles) by byte. Multiplication and division instructions require (4 machine cycles), so the time to execute an instruction is also different.


Clock cycle==1/fosc; Machine cycle=12*clock cycle; Instruction cycle=1~4 machine cycles. When using a 12M crystal oscillator, the time to execute a single-byte instruction is t=12*(1/fosc)=12*(1/12M)=1us.


Reset Circuit

Power-on automatic reset circuit: The microcontroller can be reset by applying a high level (2us) to the RST pin for more than 2 machine cycles.

Reset Circuit

1. In engineering, it is generally believed that when t=3rc~5rc, charging and discharging are completed.

2. First determine the reset time t, and then determine rc based on the conditions.


smallest system

Discussion of reset circuit: If the reset circuit is made using the above figure, the power-on delay is 100ms, and a 10K resistor is selected, then the capacitance is calculated to be 109mF, and 100mF is selected. The typical values ​​are usually selected, 10K and 10uF, then the power-on reset time is: 51ms

Discussion on crystal oscillator circuit: As mentioned above...


Discussion on I/O ports: "Current injection": current is injected from the peripheral to the MCU pin, and the MCU outputs a low level at this time; "Current pull": current is output from the MCU pin to the peripheral, and the MCU outputs a high level at this time; the maximum current of the P0 port can reach 26mA, and other I/Os are slightly weaker. The current pull is relatively poor, about 1mA. Therefore, the LED is usually lit at a low level. When the P0 port is used as a general I/O, a pull resistor (1~10K) must be added, otherwise the P0 port is used as an address/data bus.

Download circuit: P3.0 (RXD), P3.1 (TXD)

Reference address:51 MCU Overview and Design of Minimum System

Previous article:51 MCU Learning Summary Series (0) MCU Minimum System
Next article:Using 89c51 single chip microcomputer to program an adjustable perpetual calendar

Recommended ReadingLatest update time:2024-11-22 21:04

51 MCU-button part (1)
Program function: The first three digits of the digital tube display a stopwatch, which runs from 000 to 999 at a speed of 1% second. When an independent keyboard is pressed, the stopwatch stops and continues to run after the hand is released. (Design the watch using a timer).  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[Microcontroller]
Introduction to C51 MCU Timer
Introduction The timer and counter in C51 are supported by the same hardware circuit. By configuring the registers differently, it can be used as a timer or a counter. To be precise, the difference between a timer and a counter is the signal that causes the count memory behind them to increase by 1. When configured
[Microcontroller]
Homemade 51 single chip microcomputer large digital tube clock
The digital tubes sold on the market are generally very small. I made a very large digital tube by myself using LED light-emitting tubes. The display effect is very good when hung at home. The following is a real picture: Here is the circuit diagram: Below is the c51 program source
[Microcontroller]
Homemade 51 single chip microcomputer large digital tube clock
51 MCU-Software debugging to check running time
In the last lesson, we know that "for(i=0;i 30000;i++);" only delays for a certain period of time. Although we can change 30000 to other numbers (not exceeding 65535) to determine the duration of the delay, it seems a bit difficult to measure the delay of 1 second. So in this section, we will teach you how to view the
[Microcontroller]
51 MCU-Software debugging to check running time
89C51 single chip microcomputer digital tube display
Digital tube display is divided into static digital tube display and dynamic digital tube display To learn and master the contents related to digital tubes, you can start from the following three aspects: 1. Digital tube circuit diagram 2. Decoder 3. Base conversion Directly on the picture Digital tube circuit dia
[Microcontroller]
89C51 single chip microcomputer digital tube display
Introduction to 51 MCU - What is a MCU?
1. Brief introduction of single chip microcomputer 51 MCU is the abbreviation of "single-chip microcomputer", which is a general term for all MCUs compatible with Intel 8031 ​​instruction system. The ancestor of this series of MCUs is Intel's 8004 MCU. Later, with the development of Flash rom technology, 8004 MCU has
[Microcontroller]
Introduction to 51 MCU - What is a MCU?
Design of 89C51 Single Chip Microcomputer Intelligent Voice Dial Alarm System
With the improvement of people's living standards and the enhancement of security awareness, it is urgent to develop an automatic alarm system that is affordable and reliable for the general public. In view of the popularity of residential telephones and mobile communication devices, as well as the advantages of telep
[Microcontroller]
Design of 89C51 Single Chip Microcomputer Intelligent Voice Dial Alarm System
A summary of 51 MCU knowledge to see how much you know
The function signal generator based on 51 single-chip microcomputer uses the single-chip microcomputer AT89C52 to generate four waveforms: sawtooth wave, triangle wave, sine wave, and square wave by programming method, and then converts the digital signal into analog signal through D/A converter DAC0832, filters and a
[Power Management]
Latest Microcontroller Articles
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号