MCU development never uses data structures?

Click on "Uncle Wheat" above and select "Top/Star Public Account"

Welfare dry goods, delivered as soon as possible

Hello everyone, my name is Wheat.

In the work related to the development of single-chip microcomputer and embedded, is the data structure important or not ?

I think that's important.

Here, for example, in embedded systems, we often process data from sensors or some devices, such as ADCs, accelerometers/gyroscopes, or devices that record data.

Usually we can read data into the microcontroller through interfaces such as UART, I2C, , SPIetc. In many cases, the update frequency of the data is very high, often on the microsecond level, or on the millisecond level.

At this time, we need to save these data into the data structure. How to efficiently read and write data is a problem, and there is already a corresponding mechanism in C language to save data.

For example, arrays , structures , and unions commonly used in C language are all data structures, and more complex ones like queues , stacks , linked lists , binary trees , and so on.

Which data structure to use in what situation? This is a problem.

And in the source code of some open source projects, the data structure is very common. The following is the initialization function of the linked list in the FreeRTOS source code:

a5ec0f4b3ea59da30f65a96b9306a9be.png
linked list

How to master the data structure and be able to easily read these codes is also a problem.

I used to major in electronics. At the beginning, I taught myself data structures, and I thought I was half-sleep because after I finished learning C language, there was no data structure course. In most cases, I watched videos by myself, and then Learn to code by practicing.

The data structure is relatively abstract, so when we write code, we will take a pen, draw the specific implementation process, clarify the thinking, and then cooperate with the code practice, it will be much better.

Here I recommend Mr. Hao Bin's data structure video, it feels good, you might as well try it.

ea7b84c0a1f1e8b765e9c35ea86fd0b3.png

data structure

Because the data structure needs to be implemented based on a certain language, such as the C language, so we must have a solid grasp of the C language. If we feel that any knowledge point is not in place, we must check the gaps and focus on practicing.

The following recommends a learning website, which I feel is quite good:https://visualgo.net/zh

Here are some basic visualization exercises for data structures, as follows;

8c84c644949a6bd152374c9ec37c4ccf.png
e118d9b741f37db799d7d52c8ac5303c.gif

bit manipulation

e8146e2c3976531a671b86e5b15264ef.gif

sort

2456ea159c1fde2893c8f879c0ae0d2c.gif

linked list

The article is not long, I hope it can help you, the official account will reply to [ Data Structure ] in the background , and you can get the information.

d7b99aa2788dcb620715a6b79c071bfa.png

—— The End ——

Click the card below to follow me

Guess you like

Origin blog.csdn.net/u010632165/article/details/123391464