FSM Lecture 18- Exercise-003 Implementing STAT state

  • Post author:
  • Post category:Blog

 

Exercise-003 Implementing STAT state

 

 

In this article, let’s implement the STAT state.

The requirement is when the application is in IDLE mode, pressing the START/PAUSE button should show the STAT for 1 sec and auto return to the IDLE mode.

When the application is in IDLE mode, pressing the START_PAUSE button should show the STAT. That’s why we have to define one Transition from IDLE to STAT, as shown in Figure 1.

We call it START_PAUSE. No guard, no action. When the STAT state is entered, it shows the productive time, and it also sends one message, and then it should auto return after 1 second to IDLE mode.

Figure 1. Transition from IDLE to STAT

 

Let’s assume our application is in a STAT state. The STAT state doesn’t care for increment time event, decrement time event, it doesn’t care for START_PAUSE event, it also doesn’t care for Abort event. It displays something and then auto return after 1 second.  

Figure 2. Transition from STAT to IDLE
Figure 2. Transition from STAT to IDLE

 

Let’s put one more Transition from STAT to IDLE (Figure 2). We call it a TIME_TICK event. Guard is events ‘ss’ parameter should be = 10 [e->ss == 10]. When this event happens, and if (ss=10), then that is an auto return to the IDLE mode. 

We have completed the state machine diagram for our application.

 

FastBit Embedded Brain Academy Courses

Click here: https://fastbitlab.com/course1

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.

Leave a Reply