Understanding MCU from the perspective of integrated circuits

Publisher:SereneDreamerLatest update time:2015-01-20 Source: dzscKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    This article begins to understand the microcontroller from the perspective of integrated circuits, mainly introducing the pin diagram and pin functions of the microcontroller, as well as simple programming of the microcontroller.

    First, let’s take a look at the functional structure diagram of the 80C51 microcontroller.

    The 80C51 microcontroller belongs to the MCS-51 series of microcontrollers. It uses a 40-pin dual in-line package (DIP) and has 128 RAM units and 4K of ROM.

   Functional structure diagram of 80C51 microcontroller

    The following is an introduction to the pin diagram and pin functions of the microcontroller (as shown in the figure below). The specific functions of the pins will be introduced in detail later.

   The 40 pins of a microcontroller can be roughly divided into four categories: power, clock, control, and I/O pins.

    1. Power supply:

    ⑴ VCC - chip power supply, connected to +5V;

    ⑵ VSS - ground terminal;

    2. Clock:

    XTAL1, XTAL2 - Inverting input and output of the crystal oscillator circuit.

    3. Control line:

    There are 4 control lines in total

    ⑴ ALE/PROG: Address latch enable/on-chip EPROM programming pulse

    ① ALE function: used to latch the lower 8 bits of the address sent from port P0

    ② PROG function: For chips with built-in EPROM, this pin inputs programming pulses during EPROM programming.

    ⑵ PSEN: External ROM read select signal.

    ⑶ RST/VPD: reset/backup power supply.

    ① RST (Reset) function: reset signal input terminal.

    ② VPD function: When Vcc loses power, connect to backup power supply.

    ⑷ EA/Vpp: internal and external ROM selection/on-chip EPROM programming power supply.

    ① EA function: internal and external ROM selection terminal.

    ② Vpp function: For chips with EPROM inside, the programming power Vpp is applied during EPROM programming.

    4. I/O lines

    80C51 has four 8-bit parallel I/O ports: P0, P1, P2, and P3, with a total of 32 pins. Port P3 also has a second function, which is used for special signal input and output and control signals (belongs to the control bus).

    If you get a chip and want to use it, you must first know how to connect it. The chip we use is called 89C51. Let's take a look at how to connect it.

    1. Power supply: This is of course essential. The microcontroller uses a 5V power supply, with the positive pole connected to pin 40 and the negative pole (ground) connected to pin 20.

    2. Oscillation circuit: The microcontroller is a timing circuit that must be supplied with a pulse signal to work properly. An oscillator has been integrated inside the microcontroller. Use a crystal oscillator and connect it to pins 18 and 19. Just buy a crystal oscillator and a capacitor and connect them. Just connect them as shown in Figure 1.

    3. Reset pin: Connect it as shown in Figure 1. As for what reset means and why it is necessary to reset, it is introduced in the microcontroller function.

    4. EA pin: EA pin is connected to the positive power supply terminal. At this point, a single-chip microcomputer is connected, and when powered on, the single-chip microcomputer starts working.

    Our first task is to use the microcontroller to light up a light-emitting diode (LED). Obviously, this LED must be connected to a pin of the microcontroller, otherwise the microcontroller cannot control it. So which pin should it be connected to? In addition to the 5 pins just used, there are 35 pins on the microcontroller. We connect this LED to pin 1. (See Figure 1, where R1 is the current limiting resistor)

    According to the connection method in this diagram, when pin 1 is at a high level, the LED will not light up, and only when pin 1 is at a low level, the LED will light up. Therefore, we need to be able to control pin 1, that is, we need to be able to make pin 1 change to a high or low level as required. Since we want to control pin 1, we have to give it a name. We can't just call it pin 1, right? What name should we call it? INTEL, the company that designed the 51 chip, has already named it P1.0. This is a rule and cannot be changed by us.

    Figure 1 MCU simple application circuit diagram

    Simple programming of single chip microcomputer

    Now that we have a name, how do we make it 'high' or 'low'? To tell someone to do something, we just say it, which is called issuing a command. To tell a computer to do something, we also have to send a command to the computer. The command that the computer can understand is called a computer instruction. The instruction to make a pin output a high level is SETB, and the instruction to make a pin output a low level is CLR. Therefore, if we want P1.0 to output a high level, we just need to write SETB P1.0, and if we want P1.0 to output a low level, we just need to write CLR P1.0.

    Now we have a way to make the computer output P10 high or low, but how can we make the computer execute this instruction? We can't just tell the computer and leave it at that. To solve this problem, there are still a few steps to take.

    First, the computer cannot understand instructions such as SETBCLR. We have to translate the instructions into a way that the computer can understand, and then let the computer read it. What can the computer understand? It only understands one thing - numbers. Therefore, we have to change SETB P1.0 to (D2H, 90H) and CLR P1.0 to (C2H, 90H). As for why these two numbers are used, this is also stipulated by the designer of the 51 chip - INTEL, and we will not study it.

    The second step is, after getting these two numbers, how to get these two numbers into the microcontroller? This requires the help of a hardware tool "programmer". If you don't know what a programmer is, let me introduce it to you. It is a tool that uses a target generated by an assembler or other compiler to burn the code you wrote on the computer into the EPROM of the microcontroller. Programming a microcontroller of this type is a very troublesome thing. It is necessary to install it on the programmer before programming it on the device. The latest AT89s51 or STC89C51 microcontroller can support the in-circuit programming (isp) function. You don't need to pull it out and use a simple circuit to write the code into the microcontroller.

    We connect the programmer to the computer, run the programmer software, and then write (D2H, 90H) in the editing area (see Figure 2). Write... OK, take the chip off, insert the chip into the circuit board, and turn on the power... What? The light is not on? That's right, because the instruction we wrote in is to make P10 output a high level, so of course the light is not on. If it is on, it's wrong. Now we unplug this chip, put it back on the programmer, change the content of the editing area to (C2H, 90H), that is, CLR P1.0, write the chip, take the chip off, insert the chip into the circuit board, and connect the power. OK, the light is on. Because the () we wrote is the instruction to make P10 output a low level. In this way, we can see that the connection of the hardware circuit has not been changed. As long as the content written into the microcontroller is changed, the output effect of the circuit can be changed.

Keywords:MCU Reference address:Understanding MCU from the perspective of integrated circuits

Previous article:MCU minimum system composition and power supply/reset/oscillation circuit analysis
Next article:AT89C2051 single chip microcomputer drives stepper motor circuit and source code

Recommended ReadingLatest update time:2024-11-16 13:41

Single chip microcomputer controlled switch mode CO2 laser power supply
1. Computer control system composition According to the various functional requirements of CO2 laser therapy machines abroad, the power system block diagram we designed is shown in Figure 1. The power control system can be controlled by the keyboard in the following aspects: ① It can control the output power an
[Microcontroller]
Single chip microcomputer controlled switch mode CO2 laser power supply
NationalChip Technology: New generation of automotive electronics MCU products successfully tested internally
On the evening of April 7, Guoxin Technology announced that its new generation of automotive electronic MCU product "CCFC2012BC" has been successfully tested in the company's internal test recently. The company's above-mentioned chip products have completely independent intellectual property rights. As of April 7, 202
[Automotive Electronics]
ISP download circuit design of 51 microcontroller
The 51 microcontroller can be programmed through ISP download. The commonly used tools are USB/TTL. Commonly used chips include MAX232, CH340G, etc. The following introduces the ISP download circuit designed with CH340G chip. 1.51 Microcontroller program download principle The program programming interfaces of the 5
[Microcontroller]
ISP download circuit design of 51 microcontroller
MCU label information and package type
        I personally use stc chips, so I will give a brief introduction based on the numbers on the stc chips.          All the numbers on a chip are STC89C52RC 40C-PDIP 1046N1K877.90C.         Logo Explanation:         STC - chip manufacturing company.         8——Indicates that the chip is an 8051 core chip  
[Microcontroller]
Electronic clock with temperature display based on single chip microcomputer
The microcontroller source program is as follows: /* *************************************************************************************** * "Teach you how to learn 51 single chip microcomputer step by step (C language version)" * KST-51 MCU development board sample source code * * File name: main.c * Description:
[Microcontroller]
Electronic clock with temperature display based on single chip microcomputer
Design of traffic light system based on single chip microcomputer
#include stcreg.h #define uchar unsigned char #define uint unsigned int   sbit FMQ=P3^4; sbit QR=P2^7; sbit QY=P2^6; sbit QG=P2^5; sbit HR=P2^7; sbit HY=P2^6; sbit HG=P2^5; sbit ZR=P2^4; sbit ZY=P2^3; sbit ZG=P2^2; sbit YR=P2^4; sbit YY=P2^3; sbit YG=P2^2; sbit SWITCH1=P1^0; sbit SWITCH2=P1^1; sbit SWITCH3=P1^2; sbit
[Microcontroller]
Automobile electronically controlled air suspension system based on MC9S08GB60 single chip microcomputer
0 Introduction Air suspension mainly includes passive suspension and controllable electronic suspension. Passive suspension can suppress and reduce the dynamic load and vibration of the vehicle body and wheels to a certain extent, ensuring the driving safety and ride comfort of the vehicle. However, since the s
[Microcontroller]
Automobile electronically controlled air suspension system based on MC9S08GB60 single chip microcomputer
Design and implementation of MCU for multi-point video conferencing control unit
0 Introduction The multipoint control unit (MCU) of a video conference is the core device of a video conference system. All terminals participating in the conference can establish a one-to-one connection with the MCU. The terminal is responsible for collecting the sound and image of the venue, and then transmi
[Industrial Control]
Design and implementation of MCU for multi-point video conferencing control unit
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号