Embedded Programming: How to Implement State Machine Design in C Language?

Embedded Programming: How to Implement State Machine Design in C Language?

I am Lao Wen, an embedded engineer who loves learning. Follow me, and let's become better together! The state machine pattern is a behavioral pattern that effectively implements state transitions through polymorphism. Unfortunately, in embedded environments, we often have to write pure C code, and we also need to consider reentrancy and multitasking requests, which … Read more

The Most Suitable Communication Protocol for Microcontrollers: How to Design It?

The Most Suitable Communication Protocol for Microcontrollers: How to Design It?

In communication design, considering the flexibility of the protocol often leads to designing protocols as “variable length”. An example is shown in the figure below: the communication protocol frame of the Ruimi LoRa terminal. If a system receives the above “variable length” protocol frame, there will be a challenge—how to efficiently receive and parse it. … Read more

State Machine Programming in Industrial Control Systems: Design Concepts and Implementation Strategies

State Machine Programming in Industrial Control Systems: Design Concepts and Implementation Strategies

Click the little blue text to follow! A few days ago, a colleague who works with coding for inkjet printers came to me, saying that his device often “stalls”; sometimes the print head works normally, but at other times it suddenly stops and inexplicably enters cleaning mode. Seeing his worried expression, I guessed it right—this … Read more

State Machine Programming Development: Methodologies for Building Reliable Industrial Control Systems

State Machine Programming Development: Methodologies for Building Reliable Industrial Control Systems

Click the blue text to follow! Yesterday, a friend working on a packaging line complained that their control system frequently malfunctioned—sometimes the conveyor belt would suddenly stop, and sometimes the packaging would not execute in order. I asked him, “Have you used state machine programming?” He looked puzzled. Many beginners overlook this powerful tool, so … Read more

Learning JTAG Standard (IEEE1149.1) – Part 2

Learning JTAG Standard (IEEE1149.1) - Part 2

TAP controller The TAP controller is a finite state machine that transitions states based on the TMS signal at the rising edge of TCK, generating control signals to operate the JTAG circuit. The state transition diagram of the TAP controller is shown below: Each state is described as follows: Test-Logic-Reset: The test logic is disabled, … Read more

C# State Machine: A Tool for Parsing Binary Protocols

C# State Machine: A Tool for Parsing Binary Protocols

C# State Machine: A Tool for Parsing Binary Protocols Hello everyone! Today I want to share a very useful technique – using a state machine to parse binary protocols. In our work, we often need to handle various communication protocols, such as serial communication and network protocols. Using a state machine to tackle these problems … Read more

Microcontroller Programming Techniques – State Machine Programming

Microcontroller Programming Techniques - State Machine Programming

Follow and star the official account to reach exciting content directly. Source: Play with Embedded Systems Author: Alicedodo Abstract: I wonder if everyone has this feeling, that you can play with microcontrollers and drive various functional modules, but when asked to write a complete set of code, there is no logic or framework, you just … Read more

Embedded Development: State Machine + Event-Driven Framework

Embedded Development: State Machine + Event-Driven Framework

Concept of Event-Driven There are many examples of event-driven in life, like sneaking a nap during self-study while the teacher is not watching. We all went through high school, which was tough. High school students feel that sleeping is the most luxurious thing in the world; sometimes, you can even fall asleep while standing! The … Read more

Embedded Software Architecture Design – Event-Driven State Machine

Embedded Software Architecture Design - Event-Driven State Machine

Click the blue text above to learn more practical skills in embedded programming. If you find this article helpful, feel free to like and follow. Introduction Previously, we introduced finite state machines (FSM) and hierarchical state machines (HSM). This article mainly introduces the Event-Driven State Machine (ESM). A widely used design method in embedded systems … Read more

Embedded Software Architecture Design – State Machine

Embedded Software Architecture Design - State Machine

Click on the blue text above to learn more practical skills in embedded programming. If you find this article helpful, feel free to like + follow Introduction As the function business code increases, upon reviewing the code, it becomes evident that the use of if-else if-else statements is becoming more prevalent due to the need … Read more