{"id":8432,"date":"2022-03-15T04:00:11","date_gmt":"2022-03-15T04:00:11","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=8432"},"modified":"2023-08-23T17:07:39","modified_gmt":"2023-08-23T11:37:39","slug":"implementing-clock_setting-state-part-1","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/","title":{"rendered":"FSM Lecture 72: Exercise-007 Implementing CLOCK_SETTING state part-1"},"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: 31px; border-width: 0px; line-height: 48px;\"><strong><span style=\"color: #000080;\">Exercise-007 Implementing CLOCK_SETTING state part-1<\/span><\/strong><\/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-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;\">In the previous article, I completed drawing these sub-states inside this Clock_Setting, as shown in Figure 1. I have used a separate state to configure each digit of different fields.<\/span><\/p>\n<figure id=\"attachment_8435\" aria-describedby=\"caption-attachment-8435\" style=\"width: 960px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-8435\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-1-28.png\" alt=\"Figure 1. Drawing the sub-states inside the Clock_Setting\" width=\"960\" height=\"521\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28.png 960w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28-300x163.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28-768x417.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28-600x326.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28-120x65.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28-500x271.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28-200x109.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28-400x217.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-1-28-800x434.png 800w\" sizes=\"(max-width: 960px) 100vw, 960px\" \/><figcaption id=\"caption-attachment-8435\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Drawing the sub-states inside the Clock_Setting<\/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;\">You need not use two separate states to configure two separate digits of the hour field. You can even use one state, but you can use one variable to distinguish between digit1 and digit2. That also you can do. Because when you use more variables, you should also take care of initializing them and deinitializing them. Sometimes it&#8217;s better to use one more state rather than using a variable. Sometimes it makes sense to use a variable.&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;\">Now let&#8217;s talk about some pseudocode. I&#8217;ll be just briefing what we&#8217;ll be doing to handle the SET signal. <\/span><\/p>\n<figure id=\"attachment_8436\" aria-describedby=\"caption-attachment-8436\" style=\"width: 1202px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-full wp-image-8436\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-2-25.png\" alt=\"Figure 2. About pseudocode\" width=\"1202\" height=\"625\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25.png 1202w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-300x156.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-768x399.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-1024x532.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-600x312.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-120x62.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-500x260.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-200x104.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-400x208.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-800x416.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25-1200x624.png 1200w\" sizes=\"(max-width: 1202px) 100vw, 1202px\" \/><figcaption id=\"caption-attachment-8436\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. About pseudocode<\/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;\">You are in a Ticking state, and the current time is being displayed to the user, and let\u2019s say the &#8216;SET&#8217;&nbsp; signal arrives. That is an indication that we should go to Clock_Setting mode.<\/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 action for the SET signal, a transition action. Here we will copy the current time to the temporary time variable, and then this enters the Clock_Setting state. The Entry action of the Setting state will be executed, followed by Clock_Setting state, followed by the cs_hour_d1 state. But we don&#8217;t have any Entry action in the Setting state.&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 of Clock_Setting will display the temporary time we captured here (Copy curr_time to temp_time). We will display that and make the Cursor on and Blink on. Because, as you saw in the demo, we should blink the Cursor. That will do in Clock_Setting.<\/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 then, cs_hour_d1 is an initial state of a Clock_Setting super state. The state machine enters the initial state. Here, in this Entry action, we will Set the cursor at the appropriate digit. We will set the cursor.&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 state machine is in cs_hour_d1 state, whenever the SET signal is received, we have to change the digit d1.&nbsp; We will increment the digit-1 of temp_time&#8217;s hour field. We have to update the display with a new temp_time then; that will do here.<\/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 then, when the state machine is in cs_hour_d1 state and when the &#8216;OK&#8217; signal is received, there will be a transition to the next state (cs_hour_d2).<\/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;\">Here again, cs_hour_d2 will have one Entry action, and you have to Set the cursor to this digit on display. And whenever the &#8216;SET&#8217; signal is received, increment the digit-2 of the temp_time&#8217;s hour field, the same thing you have to do here. And then &#8216;OK,&#8217; it moves next 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;\">And again, you have to Set the cursor here (cs_min_d3). Increment the digit-1 of temp_time&#8217;s a minute field. I hope you can do that. This is just my logic, and you are free to implement your own logic.&nbsp;<\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 14px; box-shadow: #cecece 0px 0px 0px 0px;\"><span style=\"color: #008000;\"> \/*.${HSMs::Clock_Alarm::SM::Clock::Ticking::SET} *\/<\/span>\r\nme-&gt;temp_time = Clock_Alarm_get_curr_time()\/<span style=\"color: #ff9900;\">10<\/span>;\r\n<span style=\"color: #3366ff;\">if<\/span>(me-&gt;time_mode == MODE_12H){\r\n&nbsp; &nbsp; <span style=\"color: #ff99cc;\">&nbsp;<span style=\"color: #3366ff;\">if<\/span><\/span>(get_am_or_pm(me-&gt;temp_time).equals(\"AM\")){\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; me-&gt;temp_format = FORMAT_AM;\r\n&nbsp; &nbsp; &nbsp; }\r\n&nbsp; &nbsp; &nbsp;<span style=\"color: #3366ff;\"> else<\/span>{\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;me-&gt;temp_format = FORMAT_PM;\r\n&nbsp; &nbsp; &nbsp; }\r\n&nbsp; &nbsp; &nbsp; &nbsp;me-&gt;temp_time = convert_24hformat_to_12h(me-&gt;temp_time);\r\n}\r\n<span style=\"color: #3366ff;\">else<\/span>\r\n&nbsp; &nbsp; &nbsp; &nbsp; me-&gt;temp_format = FORMAT_24H;<\/pre>\n<p class=\"\" style=\"text-align: center;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"> TODO File code<\/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 example, let&#8217;s code for Ticking state&#8217;s SET transition action. You can see the code above.&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;\">${HSMs::Clock_Alarm::SM::Clock::Ticking::SET}<\/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;\">me-&gt;temp_time = Clock_Alarm_get_curr_time()\/10;&nbsp; Here you can see that, I am copying the current time into the temporary 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;\">If the mode is 12H, then the temporary time should be updated with a 12 hour format. That I do here. me-&gt;temp_time = convert_24hformat_to_12h(me-&gt;temp_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;\">And then, I use one more variable called temp_format. This variable will be used to capture users format selection later. Just create one class attribute called&nbsp; temp_format, where I capture what exactly is a time_format, whether it is an AM, PM, or 24H. temp_format is required later when we have to display the time format.<\/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;\">Copy the code, and I&#8217;m going to the SET transition,&nbsp; and in action, paste that code.<\/span><\/p>\n<figure id=\"attachment_8438\" aria-describedby=\"caption-attachment-8438\" style=\"width: 1252px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-full wp-image-8438\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-4-21.png\" alt=\"Figure 4. SET transition code\" width=\"1252\" height=\"418\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21.png 1252w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-300x100.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-768x256.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-1024x342.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-600x200.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-120x40.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-500x167.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-200x67.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-400x134.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-800x267.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-4-21-1200x401.png 1200w\" sizes=\"(max-width: 1252px) 100vw, 1252px\" \/><figcaption id=\"caption-attachment-8438\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. SET transition code<\/span><\/figcaption><\/figure>\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=\"color: #000000;\"><span style=\"font-weight: 400;\">This code actually needs a temp_format variable. Let&#8217;s create that. <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/p>\n<figure id=\"attachment_8439\" aria-describedby=\"caption-attachment-8439\" style=\"width: 1129px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8439\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-5-20.png\" alt=\"Figure 5.creation of temp_format variable\" width=\"1129\" height=\"607\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20.png 1129w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-300x161.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-768x413.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-1024x551.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-600x323.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-120x65.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-500x269.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-200x108.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-400x215.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-5-20-800x430.png 800w\" sizes=\"(max-width: 1129px) 100vw, 1129px\" \/><figcaption id=\"caption-attachment-8439\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Creation of temp_format variable<\/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;\">Select Clock_Alarm: QHsm, Add attribute. I&#8217;ll call this temp_format, type is uin8_t, and I&#8217;ll keep it private. Save that.<\/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;\">After that, when we reach Clock_Setting state, we should display that captured temporary time. For that, we will be using one function called display_clock_setting_time. It displays the clock setting time.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 13px; box-shadow: #cecece 0px 0px 0px 0px inset;\"><span style=\"color: #ff99cc;\">void<\/span> display_clock_setting_time(Clock_Alarm * me, uint8_t row, uint8_t col) {\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String time_as_string;\r\n\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;time_as_string = integertime_to_string(me-&gt;temp_time); \/\/hh:mm:ss\r\n\r\n&nbsp; &nbsp; &nbsp; <span style=\"color: #003300;\">&nbsp; <span style=\"color: #008000;\">&nbsp;\/*concatenate am\/pm information *\/<\/span><\/span>\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"color: #3366ff;\">if<\/span>(me-&gt;temp_format != FORMAT_24H){\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time_as_string.concat(' ');\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #3366ff;\">if<\/span>(me-&gt;temp_format == FORMAT_AM)\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time_as_string.concat(\"AM\");\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"color: #3366ff;\">else<\/span>\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;time_as_string.concat(\"PM\");\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }\r\n\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;display_write(time_as_string,row,col);\r\n&nbsp; &nbsp; &nbsp;}<\/pre>\n<p class=\"\" style=\"text-align: center;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">display_clock_setting_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;\">display_clock_setting_time converts that temporary time that you had saved in the earlier step; it just converts that into a string. And then, it concatenates the AM or PM information if required; It writes to the display.<\/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;\">Let&#8217;s create one class operation. Name it as display_clock_setting_time; return type is &#8216;void&#8217;; visibility &#8216;public&#8217;, no problem.<\/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 this has access to the &#8216;me&#8217; pointers; I will consider display_clock_setting_time a non-static function. And copy all these display_clock_setting_time codes, paste that into the code section. Save, as shown in Figure 5. Display_clock_setting_time&nbsp; we are going to call from Clock_Setting.<\/span><\/p>\n<figure id=\"attachment_8441\" aria-describedby=\"caption-attachment-8441\" style=\"width: 890px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8441\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-7-18.png\" alt=\"Figure 7. Creating a display_clock_setting_time class operation\" width=\"890\" height=\"644\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18.png 890w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18-300x217.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18-768x556.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18-600x434.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18-120x87.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18-500x362.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18-200x145.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18-400x289.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-7-18-800x579.png 800w\" sizes=\"(max-width: 890px) 100vw, 890px\" \/><figcaption id=\"caption-attachment-8441\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Creating a display_clock_setting_time class operation<\/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-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;\">Whenever the Clock_Setting state is entered as a part of the entry action, we are going to display that clock setting time.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_8442\" aria-describedby=\"caption-attachment-8442\" style=\"width: 1269px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8442\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-8-15.png\" alt=\"Figure 8. Defining a macro\" width=\"1269\" height=\"565\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15.png 1269w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-300x134.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-768x342.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-1024x456.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-600x267.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-120x53.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-500x223.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-200x89.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-400x178.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-800x356.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-8-15-1200x534.png 1200w\" sizes=\"(max-width: 1269px) 100vw, 1269px\" \/><figcaption id=\"caption-attachment-8442\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. Defining a macro<\/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;\">You have to supply the &#8216;me&#8217; pointer and the location where you want to print that.&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;\">I&#8217;ll provide the macro. #define CLOCK_SETTING_TIME_ROW, which is 0.&nbsp;&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;\">#define CLOCK_SETTING_TIME_COL, I&#8217;ll select 2 here. And I&#8217;ll use these macros in entry action, as shown in Figure 6.&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;\">Let&#8217;s go back to the state machine,&nbsp; and you should also turn on the cursor and turn on the blink of the LCD.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 14px; box-shadow: #cecece 0px 0px 0px 0px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #cc99ff;\">void<\/span> display_cursor_on_blinkon() {\r\n    lcd_cursor_show();\r\n    lcd_cursor_blink();\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"> display_cursor_on_blinkon()<\/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 that, I have given one helper function you can use that. And its name is display_cursor_on_blinkon() it does nothing actually.&nbsp; It just calls the lcd.cpp&#8217;s functions. lcd_cursor_show and lcd_cursor_blink. So, call this function in the Clock_setting \u2192 Entry action.<\/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;\">After that, the state machine enters cs_hour_d1, and we will set the cursor at d1&#8217;s position. We should call set_cursor. I will use display_set_cursor, which calls lcd_set_cursor.<\/span><\/p>\n<pre class=\"color-neutral-text-contrast color-neutral-background-color\" style=\"font-size: 14px; box-shadow: #cecece 0px 0px 0px 0px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #cc99ff;\">void<\/span> display_set_cursor(uint8_t r, uint8_t c) {\r\n     lcd_set_cursor(c,r);\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\"> display_set_cursor<\/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;\">What&#8217;s a position? <\/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;\">Where coordinates do you have to mention? <\/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;\">Row and column number. I&#8217;ll just use the macros, as shown in Figure 7.<\/span><\/p>\n<figure id=\"attachment_8445\" aria-describedby=\"caption-attachment-8445\" style=\"width: 1280px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8445 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-11-8.png\" alt=\"Implementing CLOCK_SETTING state part-1\" width=\"1280\" height=\"672\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8.png 1280w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-300x158.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-768x403.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-1024x538.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-600x315.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-120x63.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-500x263.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-200x105.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-400x210.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-800x420.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-11-8-1200x630.png 1200w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><figcaption id=\"caption-attachment-8445\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. Defining a macro<\/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;\">Row will be the same. That is 0.<\/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;\">Now let&#8217;s get back to the state machine. In cs_hour_d1, here we set the cursor. And whenever the user sends the SET signal, we should increment the d1 digit.&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;\">What I&#8217;ll do here is I will use another variable to hold the digit. I&#8217;ll create one more attribute, name it temp_digit; we will use uint8_t, private.<\/span><\/p>\n<figure id=\"attachment_8446\" aria-describedby=\"caption-attachment-8446\" style=\"width: 1073px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8446 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-12-5.png\" alt=\"Implementing CLOCK_SETTING state part-1\" width=\"1073\" height=\"612\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5.png 1073w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-300x171.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-768x438.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-1024x584.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-600x342.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-120x68.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-500x285.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-200x114.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-400x228.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-12-5-800x456.png 800w\" sizes=\"(max-width: 1073px) 100vw, 1073px\" \/><figcaption id=\"caption-attachment-8446\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 8. Creating Temp_digit variable<\/span><\/figcaption><\/figure>\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;\">Here, whenever the state machine enters cs_hour_d1 state, me-&gt;temp_digit will hold the first digit of the temporary times hour field. For that, I&#8217;ll use the macro that I introduced earlier, which is&nbsp; DIGIT1 macro. It just returns the unit field and 10th field. DIGIT1 returns the 10th field, and DIGIT2 returns the unit field.<\/span><\/p>\n<figure id=\"attachment_8447\" aria-describedby=\"caption-attachment-8447\" style=\"width: 671px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8447 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-13-3.png\" alt=\"Implementing CLOCK_SETTING state part-1\" width=\"671\" height=\"119\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-13-3.png 671w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-13-3-300x53.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-13-3-600x106.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-13-3-120x21.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-13-3-500x89.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-13-3-669x119.png 669w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-13-3-200x35.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-13-3-400x71.png 400w\" sizes=\"(max-width: 671px) 100vw, 671px\" \/><figcaption id=\"caption-attachment-8447\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 9. display_set_cursor<\/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;\">Use DIGIT1 of GET_HOUR. I&#8217;ll extract the DIGIT1 of&nbsp; GET_HOUR of temp_time. That&#8217;s it. I capture the first digit of the hour field of the temp_time.&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;\">After that, whenever the &#8216;SET&#8217; is received, I&#8217;m just going to increment that. me-&gt;temp_digit ++. For digit-1, the allowed values are 0, 1, 2. That&#8217;s why, I&#8217;ll just do me-&gt;temp_digit % = 3. Because the digit value can vary between 0, 1, and 2. It can&#8217;t be 3.&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;\">You have just changed this temp_digit; you did a &#8216;++&#8217; whenever you received the SET signal.<\/span><\/p>\n<figure id=\"attachment_8448\" aria-describedby=\"caption-attachment-8448\" style=\"width: 1201px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8448 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-14-2.png\" alt=\"Implementing CLOCK_SETTING state part-1\" width=\"1201\" height=\"410\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2.png 1201w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-300x102.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-768x262.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-1024x350.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-600x205.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-120x41.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-500x171.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-200x68.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-400x137.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-800x273.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-14-2-1200x410.png 1200w\" sizes=\"(max-width: 1201px) 100vw, 1201px\" \/><figcaption id=\"caption-attachment-8448\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 10. SET transition action code<\/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;\">Now, we have to update that information in the temporary time variable. You would first delete the earlier value and feed the new value.&nbsp;<\/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=\"color: #000000;\"><span style=\"font-weight: 400;\">I&#8217;m going to do this.<\/span> <span style=\"font-weight: 400;\">me-&gt;temp_time -= DIGIT1 (GET_HOUR(me-&gt; temp_time)) * 10UL * 3600UL;&nbsp;<\/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=\"font-weight: 400; color: #000000;\">And then, I am compensating with temp_digit value. I&#8217;m taking the digit value multiplied by 10 because it&#8217;s the 10th place. Because temp_digit should go at the 10th place and multiply by a number of seconds in one hour. First, subtract the old seconds, introduce the new second.&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;\">And then, you already have created this function display_clock_setting_time. We display the modified temporary time. And the cursor must stay at D1&#8217;s position. Once you do this, the cursor will move to somewhere else. You have to bring back the cursor at D1&#8217;s position. The code is shown in Figure 10.<\/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;\">Please note that this is not the logic you have to implement; you are free to implement anything you want. I mean, there could be some other approaches. You are free to think of your own logic.&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;\">And whenever &#8216;OK&#8217; is received here, there is an external transition; we come to cs_hour_d2. Again we have to repeat that. Whatever we have done here, we have repeated here. Copy the code of this cs_hour_d1, go to cs_hour_d2, and paste that here. Instead of DIGIT1, this is DIGIT2, and display_set_cursor D2 column.<\/span><\/p>\n<figure id=\"attachment_8449\" aria-describedby=\"caption-attachment-8449\" style=\"width: 689px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8449 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/03\/Figure-15-3.png\" alt=\"Implementing CLOCK_SETTING state part-1\" width=\"689\" height=\"283\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-15-3.png 689w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-15-3-300x123.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-15-3-600x246.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-15-3-120x49.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-15-3-500x205.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-15-3-200x82.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-15-3-400x164.png 400w\" sizes=\"(max-width: 689px) 100vw, 689px\" \/><figcaption id=\"caption-attachment-8449\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 11. SET transition action code<\/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;\">And &#8216;SET,&#8217; almost the same code you have to copy and paste here. The value of D2 can vary from&nbsp; 0 to 9. That&#8217;s why you have to use 10 here. And this is DIGIT2, and DIGIT2 is actually at the unit place. That&#8217;s why multiplying by 10 is not required. (Figure 11) Likewise, you have to modify.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 20px; line-height: 25px;\"><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;\">C<span style=\"font-weight: 400;\">lick here:&nbsp;<\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Exercise-007 Implementing CLOCK_SETTING state part-1 &nbsp; &nbsp; In the previous article, I completed drawing these sub-states inside this Clock_Setting, as shown in Figure 1. I have used a separate state to configure each digit of different fields. &nbsp; You need not use two separate states to configure two separate digits of the hour field. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8436,"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-8432","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>Implementing Clock Setting State - Part 1: Handling SET Signal and Digit Configuration<\/title>\n<meta name=\"description\" content=\"FSM Lecture 72 - Exercise-007 Implementing CLOCK SETTING state part-1 Learn how to implement the CLOCK_SETTING state for configuring the 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\/implementing-clock_setting-state-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Implementing Clock Setting State - Part 1: Handling SET Signal and Digit Configuration\" \/>\n<meta property=\"og:description\" content=\"FSM Lecture 72 - Exercise-007 Implementing CLOCK SETTING state part-1 Learn how to implement the CLOCK_SETTING state for configuring the time\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/\" \/>\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-03-15T04:00:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-23T11:37:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1202\" \/>\n\t<meta property=\"og:image:height\" content=\"625\" \/>\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=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"FSM Lecture 72: Exercise-007 Implementing CLOCK_SETTING state part-1\",\"datePublished\":\"2022-03-15T04:00:11+00:00\",\"dateModified\":\"2023-08-23T11:37:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/\"},\"wordCount\":1800,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/Figure-2-25.png\",\"keywords\":[\"Finite state Machine(FSM)\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/\",\"name\":\"Implementing Clock Setting State - Part 1: Handling SET Signal and Digit Configuration\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/Figure-2-25.png\",\"datePublished\":\"2022-03-15T04:00:11+00:00\",\"dateModified\":\"2023-08-23T11:37:39+00:00\",\"description\":\"FSM Lecture 72 - Exercise-007 Implementing CLOCK SETTING state part-1 Learn how to implement the CLOCK_SETTING state for configuring the time\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/Figure-2-25.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/Figure-2-25.png\",\"width\":1202,\"height\":625,\"caption\":\"Figure 2. About pseudocode\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/implementing-clock_setting-state-part-1\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FSM Lecture 72: Exercise-007 Implementing CLOCK_SETTING state part-1\"}]},{\"@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":"Implementing Clock Setting State - Part 1: Handling SET Signal and Digit Configuration","description":"FSM Lecture 72 - Exercise-007 Implementing CLOCK SETTING state part-1 Learn how to implement the CLOCK_SETTING state for configuring the 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\/implementing-clock_setting-state-part-1\/","og_locale":"en_US","og_type":"article","og_title":"Implementing Clock Setting State - Part 1: Handling SET Signal and Digit Configuration","og_description":"FSM Lecture 72 - Exercise-007 Implementing CLOCK SETTING state part-1 Learn how to implement the CLOCK_SETTING state for configuring the time","og_url":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-03-15T04:00:11+00:00","article_modified_time":"2023-08-23T11:37:39+00:00","og_image":[{"width":1202,"height":625,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25.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":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"FSM Lecture 72: Exercise-007 Implementing CLOCK_SETTING state part-1","datePublished":"2022-03-15T04:00:11+00:00","dateModified":"2023-08-23T11:37:39+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/"},"wordCount":1800,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25.png","keywords":["Finite state Machine(FSM)"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/","url":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/","name":"Implementing Clock Setting State - Part 1: Handling SET Signal and Digit Configuration","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25.png","datePublished":"2022-03-15T04:00:11+00:00","dateModified":"2023-08-23T11:37:39+00:00","description":"FSM Lecture 72 - Exercise-007 Implementing CLOCK SETTING state part-1 Learn how to implement the CLOCK_SETTING state for configuring the time","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/03\/Figure-2-25.png","width":1202,"height":625,"caption":"Figure 2. About pseudocode"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/implementing-clock_setting-state-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FSM Lecture 72: Exercise-007 Implementing CLOCK_SETTING state part-1"}]},{"@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\/8432","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=8432"}],"version-history":[{"count":4,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/8432\/revisions"}],"predecessor-version":[{"id":15394,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/8432\/revisions\/15394"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/8436"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=8432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=8432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=8432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}