Allicdata electronics

Electronic components, capacitors, resistors, diodes, LED lights, etc.

Basic knowledge of 10 MCUs

1. If the MCU has serial peripherals, add level conversion chips, such as MAX232 and SP3485, which are RS232 and RS485 interfaces.

2. RS485 uses differential signal negative logic, +2~+6V means 0, -6~-2 means 1. There are two-wire and four-wire two-wire, four-wire system is full-duplex communication, and two-wire system is half-duplex communication. In RS485, the master-slave communication mode is generally adopted, that is, one host has 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 a variety of media, such as twisted pair, fiber, wireless.
4. Many MCU serial ports start to have their own FIFO. The transceiver FIFO is mainly to solve the problem that the CPU is not efficient due to the frequent interruption of serial port transmission and reception.
If there is no FIFO, the data will be interrupted once without sending or receiving a data. With the FIFO, an interrupt can be generated to process the data after continuously transmitting and receiving several data (depending on the depth of the FIFO), which greatly improves the efficiency.


5. Some engineers introduced the watchdog to solve the problem when the system ran away when debugging their own system. Why didn't the thought program run off?
The program running may be a bug in the program itself, or it may be a problem with the hardware circuit (it is susceptible to interference itself or is itself a source of interference). It is generally recommended that when debugging your own system, first do not add a watchdog, and then complete debugging is stable, in addition to (crisis product safety, personal safety except).


6. How to distinguish between active buzzer and passive buzzer?

From the appearance, if the pins of the two buzzers are placed face up, it can be seen that one type of green circuit board is a source buzzer, and one type which is sealed with black glue without a circuit board is active. buzzer.
The active buzzer can be connected continuously with the rated power supply, and the passive buzzer is the same as the electromagnetic speaker, which needs to be connected to the audio output circuit to sound.
7. The purpose of the voltage comparator is mainly the generation and transformation of waveforms, the interface of analog circuits to digital circuits.
8. A common way to wake up low-power: After the processor enters low power, it stops a lot of activity. When an interrupt occurs, it can wake up the processor and return it from low-power mode to normal operation mode.
Therefore, before entering the low-power mode, it is necessary to configure the interrupts of the on-chip peripherals and allow them to continue to operate in the low-power mode. If this is not the case, only the reset and power cycle can end the low power mode. After the processor wakes up, it first executes the interrupt service routine, and then exits and executes the code in the main program.


9. Register interrupt service function: The interrupt service function has been written, but when the interrupt event occurs, the CPU still can't find it because we still lack the last step: register the interrupt service function.
There are two ways to register: First, the interrupt registration function is directly used. The advantage is that the operation is simple and the portability is good. The disadvantage is that the execution efficiency is degraded due to the remapping of the interrupt vector table into the SRAM: there is also a need to modify the startup file. The advantages are very efficient and the portability is not high.

slide potentiometer

 

10. Many MCUs provide digital power VDD/GND and analog power VDDA/GNDA. It is generally 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 is separated from VDD/GND by an inductor.
Generally, GNDA and GND are finally connected together. It is recommended to connect with a wound inductor and the contact is as close as possible to the chip (the inductor is preferably placed on the back of the PCB).

This article is reproduced by allicdata from the e-family forum