Optimizing Embedded C Code for Performance

Click the “Microcontroller” above, and select “Top/StarPublic Account to receive the latest articles!

  • Introduction

    • How to optimize embedded C code?

    • Application of Wuhan Chip Source General MCU CW32F030 series products in massage guns – Wuhan Chip Source Semiconductor Co., Ltd.

    • [C Language Advanced] Efficiently troubleshooting your C programs using assert

    • [C Language Advanced] Advanced usage of C language pointers

    • [C Language Advanced] What are “array pointers” and “pointer arrays”?

    • [C Language Advanced] Difference between sprintf and snprintf

    • What embedded applications does the Yanjingda LV4500R QR code scanning module have?

    • The role of resistors in circuits – Breadboard Community

    • Application of MOSEFET in automobiles?

    • 04_51 Entry Knowledge Accumulation_Digital Tube

    • 05_51 Entry Knowledge Accumulation_Buzzer

    • What to do when conditional compilation reports an error? This trick works

    • Differences between MCU serial communication and parallel communication, and understanding UART

    • Arduino Development – Arduino Function Library

    • STM32 serial control of LED light on and off

    • Playing with machine learning using microcontrollers

  • Microcontroller Recruitment Bulletin

  • Microcontroller Project Supply and Demand Information

How to optimize embedded C code? 1970-01-01 08:00:00

In this article, I have gathered a lot of experiences and methods. Applying these experiences and methods can help us optimize C language code in terms of execution speed and memory usage.

Introduction

In a recent project, we needed to develop a lightweight JPEG library that runs on mobile devices but does not guarantee high image quality. During this time, I summarized some methods to make programs run faster. In this article, I have collected some experiences and methods.

Applying these experiences and methods can help us optimize C language code in terms of execution speed and memory usage.

Although there are many guidelines on C code optimization, there is very little knowledge about optimization regarding the compiler and the programming machine you use.

Typically, to make your program run faster, the amount of code may need to increase. The increase in code volume may adversely affect the complexity and readability of the program. This is not allowed when writing programs for small devices like mobile phones and PDAs, which have many memory constraints.

Therefore, our motto when optimizing code should be to ensure memory usage and

…… Long press the QR code to access the original text

Optimizing Embedded C Code for Performance

Application of Wuhan Chip Source General MCU CW32F030 series products in massage guns – Wuhan Chip Source Semiconductor Co., Ltd. – Electronic Enthusiasts Network 2022-09-01 15:58

Optimizing Embedded C Code for Performance

BLDC motor applications have been booming in recent years, such as drones, electric tools, and popular hair dryers, with shipments reaching tens of millions. Especially the massage gun, which has become a popular “internet celebrity artifact” in the past two years.

The massage gun, also known as a deep muscle fascia impact instrument, is a soft tissue rehabilitation tool that relaxes the body’s soft tissues through high-frequency impacts. The massage gun can be understood as a civilian version of the DMS (electric deep muscle stimulator), with varying vibration frequencies during use, basic functions similar to DMS.

The massage gun uses its specially designed high-speed motor to drive the “gun head,” producing high-frequency vibrations that act on the deep muscles, reducing local tissue tension, alleviating pain, and promoting blood circulation.

Driven by market prospects, the number of companies entering the massage gun industry is continuously increasing. However, massage gun products are related to human health and have high quality requirements. To ensure the quality of massage gun products, the MCU chip is a very important part.

Product features of the massage gun

√ High-power DC brushless motor, high-frequency vibration

…… Long press the QR code to access the original text

Optimizing Embedded C Code for Performance

[C Language Advanced] Efficiently troubleshooting your C programs – Electronic Enthusiasts Network 2022-08-31 13:27

As we all know, when developing C programs, coding is often easy—debugging is difficult, modification is easy—troubleshooting is difficult. Debugging occupies a large part of our time during development, and correctly using various coding techniques can effectively improve the efficiency of troubleshooting problem code. Based on my practical experience, I want to share a tool for efficiently discovering problematic code during the coding/debugging phase, which is the well-known **assert**. By reading this article, you will understand the following:

What is assert?

What is the use of assert?

How to use assert?

What are the common operations of assert?

What is assert?

Assert means “assertion” in Chinese, and it is included in the code, usually presented to the user in the form of: assert(). Therefore, many developers think it is a function, and its prototype might be void assert(int expression); but after studying

…… Long press the QR code to access the original text

Optimizing Embedded C Code for Performance

[C Language Advanced] Advanced usage of C language pointers – Electronic Enthusiasts Network 2022-08-31 13:24

As everyone knows, when you first learned C language, the teacher must have told you this great truth: 【**Pointers are the soul of C language**】.

Since I started working, I have almost daily dealt with C language, and looking back, this statement is indeed correct.

This article intends to introduce advanced usage of C language pointers from an alternative perspective. By reading this article, you will understand the following knowledge:

What are pointers in C language?

Advanced applications of C language pointers: function pointers

Specific application examples of function pointers

What are pointers in C language?

What is a pointer? I believe all C language tutorials will tell you: 【A pointer is an address】. Indeed, that is the case. A pointer in C language is like the address of a house; as long as you have an address, you can access every corner of the world. The world of C language is similar; the address is everything, and with the address, nothing is impossible.

In C language, if you want to assign a value to a variable of type int a, we would write: a

…… Long press the QR code to access the original text

Optimizing Embedded C Code for Performance

[C Language Advanced] What are “array pointers” and “pointer arrays”? – Electronic Enthusiasts Network 2022-08-31 13:21

Those who have learned C language must have been tormented by these two things. What exactly are they? With this question, I want to provide you with a clear answer through this article. By reading this article, you will understand the following content:

What is an array pointer?

What is a pointer array?

What is the difference between an array pointer and a pointer array?

Precautions for using pointer arrays

What is an array pointer?

An 【array pointer】, understood literally, is a 【pointer】; the

Leave a Comment

Your email address will not be published. Required fields are marked *