MCU learning skills to share, after reading the learning of the microcontroller is not a thing

Learning to use is to understand the hardware structure of the microcontroller, as well as the application of internal resources, learn the initialization settings of various functions in assembly or C language, and implement programming of various functions. Here are some of the experiences of Xiaobian:

1

The first step: the use of digital I / O

Using the button input signal, the LED displays the output level, you can learn the digital I/O function of the pin. After pressing a button, a certain LED will light up. This is the function of the combination logic in the digital circuit, although it is very Simple, but you can learn the general idea of ​​microcontroller programming. For example, you must set a lot of registers to initialize the pins, so that the pins have digital input and output. For each function of the MCU, it is necessary to set the register that controls the function. This is the characteristic of MCU programming. Don't be afraid of trouble. All MCUs are like this. It should be noted that the two functions use the same set of I/O ports. For example, LCD and LED routines all use the PB group. If the two are combined, there will be conflicts that will not achieve the expected results. The module uses a different IO port.

2

Step 2: Use of the timer

By learning the use of timers, it is possible to implement sequential circuits with a single-chip microcomputer. The functions of the sequential circuits are powerful. There are many applications in the control of industrial and household electrical equipment. For example, a single-chip light switch with a button can be realized by a single-chip microcomputer. After the button is pressed once, the switch will automatically turn off after 3 minutes, and when the button is pressed twice, the light will not be extinguished. When the button is pressed for more than 2s, the light will be off. Digital integrated circuits can implement sequential circuits. Programmable logic devices (PLDs) can implement sequential circuits. Programmable controllers (PLCs) can also implement sequential circuits, but only single-chip microcomputers are the simplest to implement and have the lowest cost.

The use of timers is very important, and logic plus time control is the basis for the use of microcontrollers.

3 third step: interrupt

The characteristic of a single-chip computer is that a program is executed repeatedly. The execution of each instruction in the program requires a certain execution time. If the program does not execute an instruction, the action of the instruction will not occur, which will delay many rapid occurrences. Things, for example, the falling edge of the button when pressed. In order to make the MCU react to the fast action during the normal operation of the program, it is necessary to use the interrupt function of the MCU. This function is the program that interrupts the normal operation of the MCU after the fast action occurs, and processes the fast-acting action. After the process is completed, , returning to execute the normal program.

The difficulty in using the interrupt function is that you need to know exactly when the interrupt is not allowed to be generated (masked interrupt), when the interrupt is enabled (open interrupt), which registers need to be set to make some kind of interrupt work. When the interrupt starts, the program should What to do, what should the program do after the interruption is completed, and so on. After interrupting the learning, you can compile a program with a more complex structure. This program can do one thing and monitor one thing. Once the monitoring happens, interrupt the things that are being done, and handle the monitoring. Of course, you can also Monitor multiple things, the metaphor of the image, the interrupt function makes the MCU have a bowl of food, and look at the function in the pot.

The above three steps of learning, it is equivalent to the dragon 18 martial arts, will have three palms, you can barely protect your body.

4

Step 4: RS232 communication with PC

The MCU has a USART interface, especially many models in the STM8 series, which have two USART interfaces. The USART interface cannot be directly connected to the RS232 interface of the PC. The logic level between them is different. It is necessary to use a stm8s105c6 chip for level conversion. The use of the USART interface is very important. Through this interface, information can be exchanged between the MCU and the PC. Although RS232 communication is not advanced, it is very important for the interface learning. Proper use of the USART interface requires learning communication protocols, RS232 interface programming for PCs, and more. Imagine that the data on the MCU experiment board is displayed on the PC monitor, and the keyboard signal of the PC can be displayed on the MCU experiment board. What an interesting thing!

5

Step 5: Learn A/D conversion

The STM8 microcontroller has a multi-channel 12-bit A/D converter. These A/D converters allow the microcontroller to operate analog, display and detect voltage, current and other signals. Pay attention to the concepts of analog ground and digital ground, reference voltage, sampling time, slew rate, and conversion error. A simple example of using the A/D conversion function is to design a voltmeter.

6

Step 6: Learn PCI, I2C interface and LCD interface

The use of these interfaces makes it easier for the microcontroller to connect to external devices, which is important in extending the functionality of the microcontroller.

7

Step 7: Learn to compare, capture, and PWM functions

These functions enable the microcontroller to control the motor, detect the speed signal, and implement control functions such as the motor governor. If you learn all the above seven steps, you can design a general application system, which is equivalent to learning the ten strokes of the dragon, and you can attack.

8

Step 8: Learn USB and TCP/IP interfaces, hardware and software design for various industrial buses

Learning USB interface, TCP/IP interface, hardware and software design of various industrial buses is very important, because this is the development direction of current product development.

So far, it is equivalent to learning 15 strokes of dragons and 18 palms, but it is not enough to hit the realm of invincible hands in the world. Even so, it is considered a single-chip hero.

ZGAR Vape Device 1.0

ZGARVAPE

Zgar 2021's latest electronic cigarette Aurora series uses high-tech temperature control, food grade disposable pod device and high-quality material.Compared with the old model, The smoke of the Aurora series is more delicate and the taste is more realistic ,bigger battery capacity and longer battery life. And it's smaller and more exquisite. A new design of gradient our disposable vape is impressive. We equipped with breathing lights in the vape pen and pod, you will become the most eye-catching person in the party with our atomizer device vape.

The 2021 Aurora series has upgraded the magnetic suction connection, plug and use. We also upgrade to type-C interface for charging faster. We have developed various flavors for Aurora series, Aurora E-cigarette Cartridge is loved by the majority of consumers for its gorgeous and changeable color changes, especially at night or in the dark. Up to 10 flavors provide consumers with more choices. What's more, a set of talking packaging is specially designed for it, which makes it more interesting in all kinds of scenes. Our vape pen and pod are matched with all the brands on the market. You can use other brand's vape pen with our vape pod. Aurora series, the first choice for professional users!

We offer low price, high quality Disposable E-Cigarette Vape Pen,Electronic Cigarettes Empty Vape Pen, E-cigarette Cartridge,Disposable Vape,E-cigarette Accessories,Disposable Vape Pen,Disposable Pod device,Vape Pods OEM vape pen,OEM electronic cigarette OEM e-cigarette OEM e-cig to all over the world.


E99851b2412a4680Fd007a700833698aA6464f91

E-Cigarette Vape Pen,Disposable Device Vape,Vape Pen Atomizer,Latest Disposable E-Cigarette OEM vape pen,OEM electronic cigarette

ZGAR INTERNATIONAL(HK)CO., LIMITED , https://www.sze-cigarette.com

Posted on