14 Frequently Asked Questions about MCS-51 Microcontroller

Publisher:行者无疆1978Latest update time:2012-12-18 Source: 21ic Keywords:MCS-51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. What are the main functional components inside the MCS-51 microcontroller? What are their functions?

The MCS-51 microcontroller integrates basic functional components such as CPU, RAM, ROM, timer/counter, multi-function I/O port and interrupt control in one chip. The core part of the microcontroller is the CPU, which is the brain and heart of the microcontroller. The program memory is used to store the compiled program or table constants. The data memory is used to store intermediate operation results, data temporary storage and buffering, flags, etc. The timer/counter is essentially an adder counter. When it counts the internal machine cycle with a fixed time interval, it is a timer; when it counts external events, it is a counter. The main functions of the I/O interface include: buffering and latching data, address decoding, information format conversion, transfer status (peripheral status) and issuing commands. Interrupt control can solve the problem of speed matching between the CPU and peripherals, so that the microcontroller can process many random parameters and information in the system in a timely manner. At the same time, it also improves its ability to handle faults and adaptability.

2. What are the functions of the EA, ALE and PSEN terminals of the MCS-51 microcontroller?

Answer: ALE - ALE is the address latch enable signal. When accessing the external memory, ALE is used to latch the low 8-bit address signal sent by P0. PSEN - the read select signal of the external program memory. When accessing the external ROM, PSEN generates a negative pulse as the select signal of the external ROM; when accessing the external RAM or the on-chip ROM, no valid PSEN signal is generated. PSEN can drive 8 LSTTL gate inputs. EA - the control signal for accessing the external program memory. For 8051 and 8751, they have 4KB of program memory on chip. When EA is high, there are two situations when the CPU accesses the program memory: one is that the address space accessed is within the range of 0 to 4K, and the CPU accesses the on-chip program memory; the other is that when the address accessed exceeds 4K, the CPU will automatically execute the program in the external program memory. For 8031, EA must be grounded and can only access the external ROM.

3. What functions does the P3 port of the MCS-51 microcontroller have?

Answer: P3 port is a dual-function port. In addition to being used as a quasi-bidirectional general-purpose I/O port, each port line also has a second function. If each bit of P3 port is not set to the second function, it will automatically be in the first function. The second function of P3 involves the serial port, external interrupt, timer, and is related to the special function register.

4. How many interrupt sources does the 89C51 microcontroller have? What are their interrupt flags? How are these interrupt flags generated? How are they cleared to "0"?


Answer: 5, external interrupt 0: IE0, after the interrupt is enabled, it is generated when the INTO pin has a falling edge or a low level, and it is naturally cleared to 0 after responding to the interrupt

Timer 0: TF0 external interrupt 1: IE1 opens interrupt, when INT1 pin has a falling edge and a low level, it is automatically cleared to 0 after responding to the interrupt

Timer 1: After TF1 opens the interrupt, when the timing or counting time is reached, it will be automatically cleared to 0 after responding to the interrupt. In addition, if the interrupt is not opened, the software judgment is used, and the software needs to be cleared to 0.

Serial port: RI/TI, generated after receiving or sending a frame after communication starts, and needs to be cleared by software after responding to the interrupt.


5. If the frequency of the crystal oscillator is 3MHz, what is the maximum timing time of the timer/counter in working mode 0, 1, or 2?

Answer: Internal timing pulse cycle = machine cycle = 12/3Mhz = 4us

Working mode 0: Tmax

=8192*4us=32.768ms

Working mode 1: Tmax

=65536*4us=262.144ms

Working mode 2: Tmax

=256*4us=1.024ms[page]

6. When a timer/counter is used as a timer, who provides its counting pulses? What factors are related to the timing time?

Answer: Its counting pulse is provided by the machine cycle pulse output by the 12-divided frequency of the microcontroller oscillation pulse. The timing time is related to factors such as the working mode, crystal oscillator frequency and preset number.

VII. What are the characteristics of the working mode 2 of the timer/counter? What applications is it suitable for?

Answer: Working mode 2 has the characteristics of automatic reloading of initial values ​​and cyclic operation. It is suitable for generating pulse signals with fixed pulse width and used as a serial port baud rate generator.

8. The timing time of a timer is limited. How to implement serial timing of two timers to achieve longer timing?

Answer: Method 1: Let one timer time first, and after it overflows, start another timer to time;

Method 2: Add a counter to the first interrupt handling subroutine. When the counter is full, start another timer and put the event to be processed in the second interrupt handling subroutine.

9. Briefly describe the process of receiving and sending data through the serial port.

Answer: The MCS-51 microcontroller has a full-duplex asynchronous serial communication port, namely the serial receive and transmit buffer (SBUF). These two physically independent receivers and transmitters can both receive and send data. The serial port sending process is: first read 8 bits of data from accumulator A into SBUF, then the hardware at the serial port automatically adds the start bit and stop bit to form a complete frame format, and then under the control of the shift pulse, it is serially output from the TXD terminal. After a character frame is sent, the TXD output line is maintained in the 1 state, and the TI of the SCON register is set to 1 to notify the CPU that the next character frame can be sent. The process of serial port reception is: the REN bit of SCON should be in the reception-allowed state (REN=1). Under this premise, the serial port samples the RXD end. When the sampled state changes from 1 to 0, it is determined that the start bit is received. Then, under the control of the shift pulse, the data bits received through the bit sampling pulse are shifted into the receive register until the stop bit arrives, and the stop bit is sent to RB8, and the interrupt flag RI is set to notify the CPU to take a received character from SBUF.

10. Why should mode 2 be used when timer/counter T1 is used as a serial port baud rate generator? If the clock frequency and communication baud rate are known, how to calculate their initial values?

Answer: Because mode 2 has the function of automatically reloading the count value, it can generate an accurate baud rate. The baud rate of serial working mode 0 and mode 2 is fixed, so there is no need to set the initial value; when serial working mode 1 and mode 3: Baud rate: BR = (2SMOD×Td)/32 Overflow time: 1/ Td = (256-TH1)*12/ fosc Overflow rate: Td = fosc/[12×(256-TH1)] Initial value: TH1 = 256- fosc/(12* Td)

11. Why is system expansion required in microcontroller application systems?

Answer: 8031, 8032 and other single-chip microcomputers do not provide user program memory, and the program memory must be expanded to store control programs, data tables, etc.; although 8751 and other single-chip microcomputers provide users with EPROM program memory, the program memory space capacity is not large. When the program storage space is insufficient, the external program memory must be expanded. The MCS-51 series single-chip microcomputer usually has 128B to 256B of on-chip data memory, which is sufficient for general control and calculation, but if it is used for data storage, its capacity is insufficient. In this case, the data memory must be expanded. The MCS-51 series single-chip microcomputer provides 32 I/O lines to the outside, but its P0 port is used as an address/data multiplexing port, P2 port is used to provide the high 8-bit address, and its P3 port has a second function. If the program memory or data memory is expanded, the I/O port of the single-chip microcomputer is often not enough, and sometimes the I/O port must be expanded. Sometimes, the application system also involves interface issues such as data input, output, and human-computer interaction information, and the relevant interface circuit expansion must be carried out.

12. What is the meaning of A/D and D/A conversion?

Answer: A/D conversion refers to the conversion of analog signals into digital signals, which is mainly used for analog signal data acquisition in microcomputer control systems. D/A conversion refers to the conversion of digital signals into analog signals, which is mainly used to restore analog signals or perform analog control.

13. What are the main technical indicators of the DAC0832 device? What do they mean?

Answer: DAC0832 is a device that converts digital signals into analog signals. Its main technical indicators and meanings are as follows: Resolution: 8 bits, which can convert 8-bit digital quantities into analog quantities; Settling time: 1μS, that is, the time from the digital quantity being written into the 8-bit DAC register to the generation of the analog output corresponding to the input digital quantity; Input signal: a binary signal compatible with TTL level; Output signal: a current signal corresponding to the input binary signal; Power supply: a single +5V power supply;

14. What are the main technical indicators of ADC0809 device? What do they mean?

Answer: ADC0809 is an AD device that converts analog signals into digital signals. Its main technical indicators and meanings are as follows: Resolution: 8 bits, which can convert the input analog quantity into the corresponding 8-bit digital quantity; Signal input range: 0-5V; Conversion time: the time required to complete an A/D conversion, which is related to the frequency of the external clock signal. When the external clock signal is 500KHz, the conversion time is 128μS; Output signal: 8-bit binary digital quantity corresponding to the input analog signal, and the signal level is compatible with the TTL level; Power supply: single +5V power supply;

Keywords:MCS-51 Reference address:14 Frequently Asked Questions about MCS-51 Microcontroller

Previous article:What is a 51 single-chip microcomputer? What are the main products of 51 single-chip microcomputer?
Next article:Hardware Design of Digital Sensor System Based on C8051F060 MCU

Recommended ReadingLatest update time:2024-11-16 15:56

MCS-51 Timer/Counter
      How the timer/counter works       The structure of the timer/counter inside the MCS-51 microcontroller is shown in Figure 1. Timer T0 is composed of the characteristic function registers TL0 (low 8 bits) and TH0 (high 8 bits), and timer T1 is composed of the characteristic function registers TL1 (low 8
[Microcontroller]
MCS-51 Timer/Counter
Using MCS-51 single chip microcomputer to realize CPFSK modulation
In telemetry and telecontrol systems, data modulation and demodulation are often encountered problems. Some self-reporting stations do not receive remote control commands from a distance, but only collect parameters at regular intervals or when parameters change, and automatically send the collected parameters to th
[Microcontroller]
Using MCS-51 single chip microcomputer to realize CPFSK modulation
The memory organization structure of MCS-51 single chip microcomputer
Features: Harvard structure, program memory and data memory are separated, each has an independent 64K (0x0000 ~ 0xFFFF) addressing space (to be precise, internal data memory and external data memory are not the same thing). Program Memory: ① Used to store programs (executable binary code image files, including da
[Microcontroller]
The concept of timer/counter in MCS-51 microcontroller
1. Concept of timer/counter of MCS-51 microcontroller In a single-chip microcomputer, the relationship between pulse counting and time is very close. Each time a pulse is input, the value of the counter will automatically accumulate by 1, and the time taken is exactly 1 microsecond. As long as the time interval betwe
[Microcontroller]
The concept of timer/counter in MCS-51 microcontroller
What is the function of the ALE pin of the MCS-51 microcontroller? What is the signal waveform?
The ALE of the MCS-51 microcontroller is the address latch signal, which outputs two positive pulses in each machine cycle. When accessing the off-chip memory, the falling edge is used to control the external address latch to latch the low 8-bit address output from port P0. When no external memory is connected, the
[Microcontroller]
Method of simulating SPI bus with MCS-51 series microcontroller
1 Introduction SPI (Serial Peripheral Interface) bus system is a synchronous serial peripheral interface, which enables MCU to communicate with various peripheral devices in serial mode to exchange information. Peripheral settings include FLASHRAM, network controller, LCD display driver, A/D converter and M
[Microcontroller]
Method of simulating SPI bus with MCS-51 series microcontroller
Hardware knowledge about MCU
Introduction: Since the MCS-51 single-chip microcomputer is an enhanced product based on the MCS-48, it has a higher chip integration, much better performance, more hardware functions, and a wider variety of functional units than the latter. I/O Ports The number and types of I/O ports inside the MCS-51 chip are nu
[Microcontroller]
Analysis on the method of realizing PWM output function in MCS-51 series microcontroller
The MCS-51 series of microcontrollers does not have a PWM output function, which can be realized by using a timer and software. It is very practical for occasions where the accuracy is not high. It uses high-speed optical isolation 6N137 to output and inverts the PWM signal. 1. Working principle 2. PWM output 1. Fix
[Microcontroller]
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号