{"id":6857,"date":"2022-01-27T01:00:49","date_gmt":"2022-01-27T01:00:49","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=6857"},"modified":"2023-04-21T15:36:48","modified_gmt":"2023-04-21T10:06:48","slug":"exercise-003-implementing-time_set-state","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/","title":{"rendered":"FSM Lecture 16: Exercise-003 Implementing TIME_SET state"},"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: 50px;\"><span style=\"color: #000080;\">Exercise-003 Implementing TIME_SET state<\/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;\">In this article, let\u2019s process all the events for TIME_SET 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;\">The application is in TIME_SET state, and the Increment time event is received. Increment time means you have to increment the time\u2014the c_time variable.&nbsp;<\/span><\/p>\n<figure id=\"attachment_6869\" aria-describedby=\"caption-attachment-6869\" style=\"width: 569px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\" wp-image-6869\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event.png\" alt=\"Figure 1. INC_TIME event for TIME_SET state\" width=\"569\" height=\"341\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event.png 1532w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-300x180.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-768x460.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-1024x614.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-600x360.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-120x72.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-500x300.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-200x120.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-400x240.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-800x479.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Fig-1-INC_TIME-Event-1200x719.png 1200w\" sizes=\"(max-width: 569px) 100vw, 569px\" \/><figcaption id=\"caption-attachment-6869\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. INC_TIME event for TIME_SET 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=\"color: #000000;\">Now the increment time should happen inside the TIME_SET state (Figure 1).<\/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;\">This is a state which takes care of setting the time. That\u2019s why it cannot transition; it should take care inside of it.<\/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;\">Hence, increment time and decrement time will be Internal Transition for this state. It cannot ask someone else to do increment time or decrement time. It\u2019s the TIME_SET state\u2019s responsibility.<\/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;\"><span style=\"font-weight: 400;\">Select TIME_SET state and go to Internal; the trigger is <\/span><b>INC_TIME<\/b><span style=\"font-weight: 400;\">. Action is the same as previous. And there is one more action: <\/span><b>mobj-&gt;c_time+=60<\/b><span style=\"font-weight: 400;\">; it should show the incremented time on the display. <\/span><\/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;\"><span style=\"font-weight: 400;\">So, disp_time (mobj-&gt;c_time). Whenever increment time is received, it just does + to c_time and then displays the modified time. That\u2019s it.&nbsp;<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6860\" aria-describedby=\"caption-attachment-6860\" style=\"width: 639px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6860 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event.png\" alt=\"FSM-: DEC_TIME Events for TIME_SET state\" width=\"639\" height=\"383\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event.png 1532w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-300x180.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-768x460.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-1024x614.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-600x360.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-120x72.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-500x300.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-200x120.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-400x240.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-800x479.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/DEC_TIME-Event-1200x719.png 1200w\" sizes=\"(max-width: 639px) 100vw, 639px\" \/><figcaption id=\"caption-attachment-6860\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2.DEC_TIME Event for TIME_SET 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=\"color: #000000;\"><span style=\"font-weight: 400;\">Let\u2019s process the decrement time. The decrement time is also an Internal Transition. Let me add one more Internal Transition <\/span><b>DEC_TIME<\/b><span style=\"font-weight: 400;\">.<\/span><\/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;\"><span style=\"font-weight: 400;\">Action is: You have to do \u2018-\u2019 here. <\/span><b>mobj-&gt;c_time-=60<\/b><span style=\"font-weight: 400;\">; you modified the time, so display the time, mobj-&gt;c_time. That\u2019s it, as you can see in Figure 2.<\/span><\/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;\"><span style=\"font-weight: 400;\">Guard is <\/span><b>mobj-&gt;c_time &gt;=60<\/b><span style=\"font-weight: 400;\">.The current time should be greater than or at least = 60. That\u2019s a Guard. This is a Boolean expression; a Boolean expression will be FALSE if c_time is less than 60.&nbsp;<\/span><\/span><\/p>\n<blockquote class=\"\">\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"font-weight: 400; color: #000000;\">Please note that you can only increment or decrement the minutes, not the seconds, using increment time and decrement time. So, this has no effects on the seconds.<\/span><\/p>\n<\/blockquote>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6861\" aria-describedby=\"caption-attachment-6861\" style=\"width: 596px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-6861 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/ABRT-event.png\" alt=\"FSM- ABRT events\" width=\"596\" height=\"347\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event.png 1497w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-300x175.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-768x447.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-1024x596.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-600x349.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-120x70.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-500x291.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-200x116.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-400x233.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-800x465.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/ABRT-event-1200x698.png 1200w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><figcaption id=\"caption-attachment-6861\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. ABRT event<\/span><\/figcaption><\/figure>\n<p class=\"\" 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;\">The next event is ABORT.<\/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;\"> When there is an ABORT event, it just comes back to the IDLE state. I mean, no guard, no action, nothing, just ABRT.&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;\">When the ABORT event is received, it comes to the IDLE state, but the TIME_SET state has displayed something. That needs to be cleared. That\u2019s why you can give one Exit action. <\/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;\">Exit action is a disp_clr(). And when it comes to the IDLE mode, it sets everything to 0, and displays 0 and sends the message \u201cSet time.\u201d<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_6867\" aria-describedby=\"caption-attachment-6867\" style=\"width: 597px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6867 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/01\/Figure-4-10.png\" alt=\"FSM Exercise-003 Implementing TIME_SET state events\" width=\"597\" height=\"336\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10.png 1280w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-300x169.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-768x432.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-1024x576.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-600x338.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-120x68.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-500x281.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-400x225.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-800x450.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/Figure-4-10-1200x675.png 1200w\" sizes=\"(max-width: 597px) 100vw, 597px\" \/><figcaption id=\"caption-attachment-6867\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. START_PAUSE event<\/span><\/figcaption><\/figure>\n<p class=\"\" 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;\">The next event is START_PAUSE. <\/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;\">Now you have done the time settings, so now the user presses the START\/PAUSE button, so the COUNTDOWN has to be started. And that happens in the COUNTDOWN state. That\u2019s why now there will be one transition from TIME_SET state to the COUNTDOWN state (Figure 4). The trigger is START_PAUSE.<\/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;\">Guard is mobj-&gt;c_time&gt;=60, the COUNTDOWN cannot begin if minutes is 0.That\u2019s why a Guard would be mobj-&gt;c_time should be greater than or = 60. That\u2019s a Guard for this transition to happen. If this condition is not TRUE, then this transition cannot happen. That\u2019s our START_PAUSE event.&nbsp;<\/span><\/p>\n<p class=\"\">&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;\">The next event is the TIME_TICK event. <\/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;\">When the application is in TIME_SET state, it doesn\u2019t process the TIME_TICK event. I mean, there is no action that is synchronous with the time. Because TIME_SET nearly does modification to the time variable as per the \u2018+\u2019 or \u2018\u2013\u2019 button pressed by the user. It has no time-based action defined. That\u2019s why let\u2019s ignore that event in this state.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 27px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"color: #000000;\">Click here: <\/span><span style=\"color: #3366ff;\"><a style=\"color: #3366ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\">https:\/\/fastbitlab.com\/course1<\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Exercise-003 Implementing TIME_SET state &nbsp; &nbsp; In this article, let\u2019s process all the events for TIME_SET state. The application is in TIME_SET state, and the Increment time event is received. Increment time means you have to increment the time\u2014the c_time variable.&nbsp; &nbsp; Now the increment time should happen inside the TIME_SET state (Figure 1). [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6859,"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-6857","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>Exercise: TIME_SET state Implementation | FSM<\/title>\n<meta name=\"description\" content=\"TIME_SET state. This is a state which takes care of setting the time. That\u2019s why it cannot transition; it should take care inside of it.\" \/>\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\/exercise-003-implementing-time_set-state\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Exercise: TIME_SET state Implementation | FSM\" \/>\n<meta property=\"og:description\" content=\"TIME_SET state. This is a state which takes care of setting the time. That\u2019s why it cannot transition; it should take care inside of it.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/\" \/>\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-27T01:00:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-21T10:06:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/INC_TIME-event.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1699\" \/>\n\t<meta property=\"og:image:height\" content=\"1063\" \/>\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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"FSM Lecture 16: Exercise-003 Implementing TIME_SET state\",\"datePublished\":\"2022-01-27T01:00:49+00:00\",\"dateModified\":\"2023-04-21T10:06:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/\"},\"wordCount\":663,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/INC_TIME-event.png\",\"keywords\":[\"Finite state Machine(FSM)\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/\",\"name\":\"Exercise: TIME_SET state Implementation | FSM\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/INC_TIME-event.png\",\"datePublished\":\"2022-01-27T01:00:49+00:00\",\"dateModified\":\"2023-04-21T10:06:48+00:00\",\"description\":\"TIME_SET state. This is a state which takes care of setting the time. That\u2019s why it cannot transition; it should take care inside of it.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/INC_TIME-event.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/INC_TIME-event.png\",\"width\":1699,\"height\":1063,\"caption\":\"Figure 1. INC_TIME event for TIME_SET state\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/exercise-003-implementing-time_set-state\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FSM Lecture 16: Exercise-003 Implementing TIME_SET state\"}]},{\"@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":"Exercise: TIME_SET state Implementation | FSM","description":"TIME_SET state. This is a state which takes care of setting the time. That\u2019s why it cannot transition; it should take care inside of it.","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\/exercise-003-implementing-time_set-state\/","og_locale":"en_US","og_type":"article","og_title":"Exercise: TIME_SET state Implementation | FSM","og_description":"TIME_SET state. This is a state which takes care of setting the time. That\u2019s why it cannot transition; it should take care inside of it.","og_url":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-01-27T01:00:49+00:00","article_modified_time":"2023-04-21T10:06:48+00:00","og_image":[{"width":1699,"height":1063,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/INC_TIME-event.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"FSM Lecture 16: Exercise-003 Implementing TIME_SET state","datePublished":"2022-01-27T01:00:49+00:00","dateModified":"2023-04-21T10:06:48+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/"},"wordCount":663,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/INC_TIME-event.png","keywords":["Finite state Machine(FSM)"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/","url":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/","name":"Exercise: TIME_SET state Implementation | FSM","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/INC_TIME-event.png","datePublished":"2022-01-27T01:00:49+00:00","dateModified":"2023-04-21T10:06:48+00:00","description":"TIME_SET state. This is a state which takes care of setting the time. That\u2019s why it cannot transition; it should take care inside of it.","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/INC_TIME-event.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/01\/INC_TIME-event.png","width":1699,"height":1063,"caption":"Figure 1. INC_TIME event for TIME_SET state"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/exercise-003-implementing-time_set-state\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FSM Lecture 16: Exercise-003 Implementing TIME_SET state"}]},{"@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\/6857","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=6857"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6857\/revisions"}],"predecessor-version":[{"id":14498,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/6857\/revisions\/14498"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/6859"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=6857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=6857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=6857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}