Modularization in Embedded Programming

Modularization in Embedded Programming

For many, in the process of embedded software development, modularization seems like a mirage, a written term, a past trend—modularization seems to have never truly been realized. When boasting, people often disdainfully say: “You may not have seen a pig run, but have you never eaten pork?” In fact, if the subject of discussion is … Read more

Dancing on the Tip of Embedded C Programming: 7 Examples from a 15-Year Veteran

Dancing on the Tip of Embedded C Programming: 7 Examples from a 15-Year Veteran

Compiled from online information, Author: Xiao Ma Er I can’t remember when I started frequently taking on recruitment work for companies, focusing on the recruitment of industrial embedded product R&D personnel. Out of a responsible attitude towards both the company and newcomers, I tend to look for candidates who have solid foundational knowledge and an … Read more

Understanding the Stack in Embedded Programming

Understanding the Stack in Embedded Programming

What is a Variable? A variable can generally be classified as shown in the figure below: The focus of this section is to help everyone understand the memory model of the stack, temporarily ignoring the case of static variables, and we agree on the following: “Global variables” are simply assumed to be “ordinary global variables”; … Read more

Discussing the Complexity of Embedded Programming

Discussing the Complexity of Embedded Programming

Embedded programming is a complex and challenging field, especially for developers transitioning from PC programming to embedded programming. In this process, it is crucial to understand and adapt to the unique mindset of embedded programming. This article will gradually delve into the essence of embedded programming from the perspective of PC programming, using practical examples … Read more

PC Software Encryption Solutions

PC Software Encryption Solutions

In the field of computing, program packing refers to executing a “pack” program before the original program runs, and then handing the program back to the original program. The benefit of this approach is that the true entry point (OEP) of the executable program cannot be easily found through conventional cracking methods, effectively preventing the … Read more

QM UML State Machine Modeling Example: Blinky for Cortex-M0

QM UML State Machine Modeling Example: Blinky for Cortex-M0

Follow and star our official account for exciting content Source: Quanran Electronics Compiled by: Li Xiaoyao There are already many tutorials on the QP event state machine framework, and with the availability of Chinese version books, learning QP can be relatively quick. However, experienced engineers may be too busy with work to learn more technologies. … Read more

Why C++ is Rarely Used in Microcontroller Development

Why C++ is Rarely Used in Microcontroller Development

When it comes to embedded programming, many people’s first impression is C/C++. However, you will find that microcontroller development is mostly done in C, with very few using C++. So, can C++ be used for microcontroller development? The answer is definitely yes. Below, based on Keil and STM32, I will describe how to use C++ … Read more

Master the ‘Black Magic’ of C Language Macros in 5 Minutes! `#` and `##` Double Your Code Efficiency

Master the 'Black Magic' of C Language Macros in 5 Minutes! `#` and `##` Double Your Code Efficiency

Are you still using the most basic<span>#define PI 3.14</span>?80% of embedded engineers have not truly harnessed the power of macros! When you see meaningless entries in your debug logs like<span>val=123</span>, when your code is filled with repetitive type conversions, and when you want to implement generic operations but feel helpless—today, these two symbols willrevolutionize your … Read more

Sharing an Embedded Programming Template

Sharing an Embedded Programming Template

Input Events to State Machine #include "stdio.h" #define EXECUTE_VOID(func) {if((func)!=NULL) (func());} typedef void(*select_machine_t)(void); typedef enum _event_index{ event_index_1 = 0, event_index_2, event_index_3, event_index_end} event_index_e; typedef enum _status_index{ status_index_1 = 0, status_index_2, status_index_end} status_index_e; void machine_1(void); void machine_2(void); void machine_3(void); void machine_4(void); select_machine_t select_machine[event_index_end][status_index_end] = { {machine_1, machine_2}, {NULL, machine_3}, {machine_4, NULL}}; void machine_1(void){ printf("machine_1\r\n"); } void … Read more

Advanced Embedded Programming | JavaScript Implementation of CRC16-MODBUS Function Code (Is DeepSeek Wrong?!?)

Advanced Embedded Programming | JavaScript Implementation of CRC16-MODBUS Function Code (Is DeepSeek Wrong?!?)

01Introduction: Let’s start with the correct code. We will use a six-byte array for testing: [0x0a, 0x03, 0x02, 0x00, 0x00, 0x16]. 02Function and Results 1. Function // Example with 0a 03 02 00 00 16 var buffer = [0x0a, 0x03, 0x02, 0x00, 0x00,0x16]; // Call the function to calculate the CRC checksum var crc = … Read more