The serial port of the microcontroller sends interrupt program 10

Updated on technology 2024-05-18
9 answers
  1. Anonymous users2024-02-10

    Initialize three interrupts, x0 x1 t2.

    T2 is started by x0 to send serial data at regular intervals and in cycles;

    T2 is closed by x1.

  2. Anonymous users2024-02-09

    This seems to have to get a master program, and you have to have a slave program.

  3. Anonymous users2024-02-08

    Serial port send request interruption time, serial port sending is also related to electronic components, so serial port send request interruption time, then only on the network can reach the serial port send request interruption time, other can not reach the serial port, send this request in the middle of the time.

    Interrupt is like a background operation, in the process of the main program, there is no need to deliberately pay attention to whether the interrupt mode is sent, when it is received, etc., and the query method is to continuously check whether the data has been received in the main program process, generally using while to continuously check in a loop.

    The interrupt mode can make more efficient use of the CPU, save the time of the CPU, and the query will increase the burden on the CPU.

    Origin. The serial port appeared around 1980, and the data transmission rate was 115kbps to 230kbps. In the early days, serial ports were used to connect computer peripherals, and were generally used to connect mice and external modems, as well as old-fashioned cameras and clipboards.

    Serial port can also be used for interconnection and data transmission between two computers (or devices).

    Due to the fact that the serial port (COM) does not support hot swapping and the transfer rate is low, some new motherboards and most laptops have begun to remove the stool interface. Serial ports are mostly used in industrial control and measurement equipment and some communication equipment.

  4. Anonymous users2024-02-07

    I don't know what series of single-chip microcomputers you are talking about. Below is the assembly of 51 microcontrollers and the statement of clearing interrupts in C language. Compilation:

    clr ie0 ;Clear the external interrupt scatter kernel for this int0 request flag clr ie1 ; Clear the external interrupt int1 request flag clr tf0 ; Clear timer t0 interrupt request flag clr tf1 ; Clear Timer T1 Interrupt Request Flag CLR RI; Serial Communication Receive Interrupt Request Flag CLR TI ; Serial communication send interrupt request flag c language: ie0=0; Clear the external interrupt int0 request flag ie1=0; Clear the external interrupt int1 request flag tf0=0; Clear the interrupt request flag of the fixed impulse timer t0 tf1=0; Clear timer t1 interrupt request flag ri=0; Serial communication receive interrupt request flag ti=0; Serial communication sends an interrupt request.

    I think it's useful, give it a thumbs up.

  5. Anonymous users2024-02-06

    Devices that need to respond to external events use the microcontroller interrupt interface.

    MCU interrupt means that in the process of executing the main program, when a specific event occurs, the MCU automatically pauses the execution of the main program and jumps to the corresponding interrupt service program to execute. This mechanism can effectively improve the ability and efficiency of the monolithic Hu Feng machine to deal with external events, so it is widely used in embedded devices that need to respond quickly to events. For example, devices in smart homes, medical devices, industrial controls, automotive electronics, and other fields often need to use interrupt interfaces to handle various events, such as input signals, sensor data, communication protocols, etc.

    In short, the microcontroller interrupt interface is an important part of the embedded system, which is widely used in various devices that need to respond quickly to external events. Different types of equipment need to use different interrupt interfaces, so when designing or using equipment, it is necessary to select the appropriate microcontroller, interrupt device and software driver according to specific needs to ensure the performance and stability of the equipment.

  6. Anonymous users2024-02-05

    Set is to mean what you want the CPU to do, as long as the CPU goes to do this set, it is useless, because it is already dry. Interrupts are just higher priority programs, and the program is not not written, but already included, but you don't have to write it yourself.

  7. Anonymous users2024-02-04

    You don't use interrupts when sending data, you just use interrupts when you receive them. This is generally the case.

  8. Anonymous users2024-02-03

    First of all, interrupt handlers that are too long are not allowed.

    In reality, enter the interruption, close the interruption, process, and open the interruption again. There are also ways to deal with this.

    Try to use flags to shorten the processing function.

    Interrupt-interrupt function (interrupt-interrupt function (interrupt-interrupt function)), so that the re-entry is until the microcontroller resource is exhausted.

  9. Anonymous users2024-02-02

    Instead of being automatically discarded, it is received repeatedly, resulting in later data being overwritten with the first received and unprocessed data.

    For example, if the other party sends you a string of 0x x x03, if you interrupt the function too much, you may receive 0x x03 after taking the 0x01 out of the buffer and in the process of processing, then the 0x03 will overwrite the 0x02, resulting in you can only take out the 0x03 the next time you enter the serial port interrupt function.

    Therefore, the interrupt function must be concise and efficient, and as long as it is not a fire-burning judgment process, it should be thrown into the main loop or a regular task.

    In addition, many single-chip microcomputer serial ports now have hardware FIFO, and making good use of FIFO will also greatly improve the interrupt efficiency of the whole system.

Related questions
4 answers2024-05-18

How is your light-emitting diode connected, if there is a power supply stringed to the light-emitting diode, the low level will be on, if it is the output port of the single-chip microcomputer, it will not be on.

4 answers2024-05-18

You use a P1 port to control the dynamic scanning of 8 digital tubes, and the dynamic scanning display of digital tubes needs to be blanked. >>>More

5 answers2024-05-18

Hello: I wrote the program:

#include >>>More

18 answers2024-05-18

Landlord, org 0030h.

How do you understand what I mean? >>>More

2 answers2024-05-18

Summary. Please tell me about the specific question, dear. >>>More