{"id":6804,"date":"2022-01-24T10:39:36","date_gmt":"2022-01-24T10:39:36","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=6804"},"modified":"2023-04-21T15:21:23","modified_gmt":"2023-04-21T09:51:23","slug":"fsm-lecture-14-exercise-003-defining-states-entry-exit-actions","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/","title":{"rendered":"FSM Lecture 14: Exercise-003 Defining states Entry and Exit actions"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 30px; border-width: 0px; line-height: 45px;\"><span style=\"color: #000080;\">Exercise-003 Defining states Entry and Exit actions<\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">To reduce the clutter on the diagram, you will use short names instead of full variable names. Like c_time, e_time, and p_time.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 22px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 35px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><strong><span style=\"text-decoration: underline;\">Entry Actions:<\/span><\/strong><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">As per the demo(figure 1), the LCD should display a \u2018Set time.\u2019 Whenever you give power to the application, the time component shows 0 (0 seconds, 0 minutes).<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">That\u2019s why, whenever the application comes to the IDLE state, it should display something. That\u2019s why we will now define the Entry activity for the IDLE state. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Just click on IDLE state, and at the left-hand side, you can see Entry\/Do\/Exit(Figure 2).<\/span><\/p>\n<figure id=\"attachment_6807\" aria-describedby=\"caption-attachment-6807\" style=\"width: 1280px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-6807 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/IDLE-set-time.png\" alt=\"Figure 1. IDLE state\" width=\"1280\" height=\"720\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time.png 1280w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-300x169.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-768x432.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-1024x576.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-600x338.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-120x68.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-500x281.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-400x225.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-800x450.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time-1200x675.png 1200w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><figcaption id=\"caption-attachment-6807\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. IDLE state <\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6808\" aria-describedby=\"caption-attachment-6808\" style=\"width: 2140px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6808 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions.png\" alt=\"Entry and Exit actions\" width=\"2140\" height=\"964\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions.png 2140w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-300x135.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-768x346.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-1024x461.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-600x270.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-120x54.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-500x225.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-200x90.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-400x180.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-800x360.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-2.Entry-actions-1200x541.png 1200w\" sizes=\"(max-width: 2140px) 100vw, 2140px\" \/><figcaption id=\"caption-attachment-6808\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Entry action for IDLE state<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px;\"><span style=\"font-weight: 400; color: #000000;\">Let\u2019s define the Entry action. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 18px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">One Entry action could display the time on the LCD; I will call disp_time. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 31px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Display time is a helper action; it\u2019s a helper action or just an action that displays the time. But initially, whenever the application is in the IDLE state, it should display 0. That\u2019s why the argument I send is just 0. The display time function displays as per the argument being passed. So, the argument being passed <strong>disp_time(0)<\/strong>.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And as you can see in the demo(Figure 2), it also shows one message to the user, \u201cSet time\u2019\u2019; display message, that is another action function.&nbsp; <strong>disp_msg(\u201cSet time\u201d)<\/strong>. These are the 2 Entry actions.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6809\" aria-describedby=\"caption-attachment-6809\" style=\"width: 1944px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-full wp-image-6809\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1.png\" alt=\"Figure 3. Entry action for IDLE state\" width=\"1944\" height=\"1046\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1.png 1944w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-300x161.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-768x413.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-1024x551.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-600x323.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-120x65.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-500x269.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-200x108.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-400x215.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-800x430.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-3.-Entry-action-1-1200x646.png 1200w\" sizes=\"(max-width: 1944px) 100vw, 1944px\" \/><figcaption id=\"caption-attachment-6809\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Entry action for IDLE state<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">We should also make a mobj-&gt;curr_time=0; and also, mobj-&gt;elaspsed_time=0;because it&#8217;s in the IDLE state.&nbsp; mobj-&gt;current_time =0; elapsed_time=0; and display&nbsp; time as 0; and display the message as \u201cSet time\u201d. These are the Entry actions. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And since we are already doing c_time=0, e_time=0, here it is not required, I will just make p_time =0 here. That\u2019s our Entry action for this.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6810\" aria-describedby=\"caption-attachment-6810\" style=\"width: 1516px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6810 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state.png\" alt=\"Entry and Exit actions\" width=\"1516\" height=\"1080\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state.png 1516w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-300x214.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-768x547.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-1024x729.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-600x427.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-120x85.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-500x356.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-200x142.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-400x285.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-800x570.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-4.TIME_SET-state-1200x855.png 1200w\" sizes=\"(max-width: 1516px) 100vw, 1516px\" \/><figcaption id=\"caption-attachment-6810\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. TIME_SET state<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s discuss the TIME_SET state. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px;\"><span style=\"font-weight: 400; color: #000000;\">Whenever the application comes to the TIME_SET state, it should display the current time. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s define one Entry action for this. Entry action for TIME_SET state is disp_time; And you have to display their current time (c_time). So, whenever an application comes to the TIME_SET state, it displays the time.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6811\" aria-describedby=\"caption-attachment-6811\" style=\"width: 1280px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6811 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state.png\" alt=\"Entry and Exit actions\" width=\"1280\" height=\"720\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state.png 1280w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-300x169.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-768x432.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-1024x576.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-600x338.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-120x68.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-500x281.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-400x225.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-800x450.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-5.Paused-state-1200x675.png 1200w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><figcaption id=\"caption-attachment-6811\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. PAUSE state<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let\u2019s write the Entry action for PAUSE state. Whenever you press the PAUSE button, the COUNTDOWN stops and shows the message \u201cpaused.\u201d&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The Entry action for this would be disp_msg(\u201cpaused\u201d), and it doesn\u2019t respect the COUNTDOWN. But whenever the application comes to PAUSE state, it should send the message \u201cpaused.\u201d<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6812\" aria-describedby=\"caption-attachment-6812\" style=\"width: 1932px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6812 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state.png\" alt=\"Entry and Exit actions\" width=\"1932\" height=\"1080\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state.png 1932w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-300x168.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-768x429.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-1024x572.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-600x335.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-120x67.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-500x280.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-200x112.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-400x224.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-800x447.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-6.COUNTDOWN-state-1200x671.png 1200w\" sizes=\"(max-width: 1932px) 100vw, 1932px\" \/><figcaption id=\"caption-attachment-6812\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. COUNTDOWN state<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 28px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For the COUNTDOWN, it should COUNTDOWN every one second. Whenever this state receives the TICK event, there will be counting down process. That\u2019s why I have no idea whether this requires the Entry action or not; if you don\u2019t have any idea, then you leave it. But I don\u2019t want to define any Entry action for COUNTDOWN.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6813\" aria-describedby=\"caption-attachment-6813\" style=\"width: 1141px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6813 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1.png\" alt=\"Entry and Exit actions\" width=\"1141\" height=\"686\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1.png 1141w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-300x180.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-768x462.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-1024x616.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-600x361.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-120x72.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-500x301.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-200x120.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-400x240.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-7.STAT-state-1-800x481.png 800w\" sizes=\"(max-width: 1141px) 100vw, 1141px\" \/><figcaption id=\"caption-attachment-6813\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. STAT state<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let\u2019s go to the statistics state(STAT state). <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">As you can see in the demo, whenever you press the START or PAUSE button, it shows the productive time and displays the message \u201cProductive time.\u201d <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The demo should show the productive time in the first line of the display and send a message at the second line. That means we have two actions here. disp_time(mobj-&gt;p_time), and disp_msg( \u201cproductive time\u201d).<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You end each action with a semicolon whenever you have two or more actions to do. That looks nice.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px;\"><span style=\"color: #000080;\"><strong><span style=\"text-decoration: underline;\">EXIT Actions:<\/span><\/strong><\/span><\/p>\n<figure id=\"attachment_6814\" aria-describedby=\"caption-attachment-6814\" style=\"width: 1393px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6814 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action.png\" alt=\"Entry and Exit actions\" width=\"1393\" height=\"939\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action.png 1393w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-300x202.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-768x518.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-1024x690.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-600x404.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-120x81.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-500x337.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-200x135.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-400x270.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-800x539.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-8.Exit-action-1200x809.png 1200w\" sizes=\"(max-width: 1393px) 100vw, 1393px\" \/><figcaption id=\"caption-attachment-6814\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 8. Exit action for IDLE state<\/span><\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s define some Exit actions. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s start with&nbsp; IDLE. The IDLE state during the Entry it has displayed something. And when the application receives some events it goes to some other state, and it may display something else. So, while exiting that state, it has to clear whatever message it has displayed. That&#8217;s why I would define the exit action; for this state, the exit action is &#8216;disp_clr.&#8217;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And for the STAT state also the exit action would be disp_clr.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For the TIME_SET state, it may be required; I\u2019m not going to define any exit action for the time being.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For the PAUSE, also it had displayed \u201cpaused.\u201d So, it should clear it up. I would define an exit action for PAUSE state as \u2018disp_clr.\u2019<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And for the COUNTDOWN, I\u2019m not sure whether I have to define any exit action or not. Let\u2019s see later.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 21px;\"><span style=\"color: #000000;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"font-weight: 400; color: #000000;\">click here:<\/span><span style=\"text-decoration: underline;\"><span style=\"color: #3366ff; text-decoration: underline;\"><a style=\"color: #3366ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Exercise-003 Defining states Entry and Exit actions &nbsp; &nbsp; To reduce the clutter on the diagram, you will use short names instead of full variable names. Like c_time, e_time, and p_time. &nbsp; Entry Actions: As per the demo(figure 1), the LCD should display a \u2018Set time.\u2019 Whenever you give power to the application, the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6807,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[17],"class_list":["post-6804","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-finite-state-machine","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>States Entry and Exit actions | Finite State Machine(FSM)<\/title>\n<meta name=\"description\" content=\"Exercise-003 Defining states Entry and Exit actions. One Entry action could display the time on the LCD; I will call disp_time. Display time\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"States Entry and Exit actions | Finite State Machine(FSM)\" \/>\n<meta property=\"og:description\" content=\"Exercise-003 Defining states Entry and Exit actions. One Entry action could display the time on the LCD; I will call disp_time. Display time\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-24T10:39:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-21T09:51:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"FSM Lecture 14: Exercise-003 Defining states Entry and Exit actions\",\"datePublished\":\"2022-01-24T10:39:36+00:00\",\"dateModified\":\"2023-04-21T09:51:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/\"},\"wordCount\":852,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/IDLE-set-time.png\",\"keywords\":[\"Finite state Machine(FSM)\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/\",\"name\":\"States Entry and Exit actions | Finite State Machine(FSM)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/IDLE-set-time.png\",\"datePublished\":\"2022-01-24T10:39:36+00:00\",\"dateModified\":\"2023-04-21T09:51:23+00:00\",\"description\":\"Exercise-003 Defining states Entry and Exit actions. One Entry action could display the time on the LCD; I will call disp_time. Display time\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/IDLE-set-time.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/IDLE-set-time.png\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FSM Lecture 14: Exercise-003 Defining states Entry and Exit actions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"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.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"States Entry and Exit actions | Finite State Machine(FSM)","description":"Exercise-003 Defining states Entry and Exit actions. One Entry action could display the time on the LCD; I will call disp_time. Display time","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/","og_locale":"en_US","og_type":"article","og_title":"States Entry and Exit actions | Finite State Machine(FSM)","og_description":"Exercise-003 Defining states Entry and Exit actions. One Entry action could display the time on the LCD; I will call disp_time. Display time","og_url":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-01-24T10:39:36+00:00","article_modified_time":"2023-04-21T09:51:23+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"FSM Lecture 14: Exercise-003 Defining states Entry and Exit actions","datePublished":"2022-01-24T10:39:36+00:00","dateModified":"2023-04-21T09:51:23+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/"},"wordCount":852,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time.png","keywords":["Finite state Machine(FSM)"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/","url":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/","name":"States Entry and Exit actions | Finite State Machine(FSM)","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time.png","datePublished":"2022-01-24T10:39:36+00:00","dateModified":"2023-04-21T09:51:23+00:00","description":"Exercise-003 Defining states Entry and Exit actions. One Entry action could display the time on the LCD; I will call disp_time. Display time","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/IDLE-set-time.png","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/fsm-lecture-14-exercise-003-defining-states-entry-exit-actions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FSM Lecture 14: Exercise-003 Defining states Entry and Exit actions"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"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."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=6804"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6804\/revisions"}],"predecessor-version":[{"id":12832,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6804\/revisions\/12832"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/6807"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=6804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=6804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=6804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}