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
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
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
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.
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)
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
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Fundamentals and Applications of Single Chip Microcomputers (Edited by Zhang Liguang and Chen Zhongxiao)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- 【TI recommended course】#Lecture on basic knowledge of electronic circuits#
- Capacitor Basics - Chip Multilayer Ceramic Capacitors
- Interpretation of the power amplifier circuit principle! Hand-drawn circuit diagram
- ON Semiconductor Receives Intel's Preferred Supplier Award
- EEWORLD University Hall----Teacher Tang talks about operational amplifiers
- Using the ADC of MSP430F5437A to measure the voltage of two 1.5v dry batteries
- AD8629 input square wave abnormality
- Tiny Raspberry Pi Pico Keyboard
- Automobile knowledge: Things to pay attention to when running in automobile brake pads
- F28027—GPIO, some small examples of my own experiments, share them,