1. If the MCU has a serial port peripheral, adding a level conversion chip, such as MAX232 or SP3485, will make it an RS232 or RS485 interface.
2. RS485 uses differential signal negative logic, +2~+6V represents 0, -6~-2 represents 1. There are two types of wiring: two-wire and four-wire. The four-wire system is a full-duplex communication method, and the two-wire system is a half-duplex communication method. RS485 generally uses a master-slave communication method, that is, one host with multiple slaves.
3.Modbus is a protocol standard that can support a variety of electrical interfaces, such as RS232, RS485, and can also be transmitted on various media, such as twisted pair, optical fiber, and wireless.
4. Many MCU serial ports have begun to have their own FIFO. The transmit and receive FIFO is mainly used to solve the problem of low CPU efficiency caused by too frequent serial port transmit and receive interrupts.
If there is no FIFO, an interrupt will be required for each data sent or received. With FIFO, an interrupt will be generated to process the data only after a number of data are sent or received continuously (depending on the depth of the FIFO), which greatly improves efficiency.
5. When some engineers are debugging their own systems and the system crashes, they immediately introduce a watchdog to solve the problem without thinking about why the program crashes?
The program may be a bug in the program itself, or it may be a problem with the hardware circuit (it is susceptible to interference or is the source of interference). It is usually recommended not to add a watchdog when debugging your own system, and then add it after it is fully debugged and stable (except when it endangers product safety or personal safety).
6. How to distinguish active buzzers from passive buzzers?
From the appearance, if the pins of the two buzzers are placed upward, it can be seen that the one with a green circuit board is the source buzzer, and the one without a circuit board but sealed with black glue is the active buzzer.
An active buzzer can make continuous sound by directly connecting it to a rated power supply, while a passive buzzer, like an electromagnetic speaker, needs to be connected to an audio output circuit to make sound.
7. The purpose of voltage comparator is mainly to generate and transform waveforms and to interface analog circuits to digital circuits.
8. Common ways to wake up from low power consumption: When the processor enters low power consumption mode, many activities are stopped. When an interrupt occurs, the processor can be woken up and returned from low power consumption mode to normal operation mode.
Therefore, before entering low-power mode, the interrupts of various on-chip peripherals must be configured and allowed to continue working in low-power mode. If not, low-power mode can only be ended by resetting and powering on again. After waking up, the processor first executes the interrupt service routine, and then executes the code in the main program after exiting.
9. Register the interrupt service function: The interrupt service function has been written, but when an interrupt event occurs, the CPU still cannot find it because we are still missing the last step: registering the interrupt service function.
There are two ways to register: one is to directly use the interrupt registration function, which has the advantages of simple operation and good portability, and the disadvantage is that the execution efficiency is reduced due to remapping the interrupt vector table to SRAM: the other method is to modify the startup file, which has the advantage of high efficiency, but certain portability is not high.
10Many MCUs provide digital power VDD/GND and analog power VDDA/GNDA. It is usually recommended to use two different 3.3V power supplies. However, in order to save costs, a single 3.3V power supply can also be used, but VDDA/GNDA must be separated from VDD/GND through an inductor.
Generally, GNDA and GND must be connected together in the end. It is recommended to use a winding inductor to connect them and place the contact as close to the chip as possible (the inductor is best placed on the back of the PCB).
|