FSM Lecture 69: Exercise-007 Reading curr_time through class operation

 

Exercise-007 Reading curr_time through class operation


In the Clock_Alarm_display_curr_time function, we get the current time using Clock_Alarm_get_curr_time function, which is not implemented. Let’s implement this function.

Reading current time through class operation
Figure 1. Clock_Alarm_get_curr_time function implementation

Here, you have to return the current time variable, which is Clock_Alarm_curr_time. But before returning, that is, you are reading the Clock_Alarm_curr_time variable. So, you have to disable the interrupt. Again the same technique. Write the code as shown in Figure 1. You should not save here. You can save it here, no problem, because I made it as an external file. The same code also needs to be copied in the model.

 

You have to put that code in the get_curr_time function. Go to the get_curr_time function and paste that code, as shown in Figure 2. Save and generate the code.

Reading curr_time through class operation
Figure 2. get_curr_time function

In the upcoming article, we will test this code on the LCD; before testing, we have to add an LCD initialization code.

 

FastBit Embedded Brain Academy Courses,

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

 

FastBitLab

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