FSM Lecture 90| Exercise-008:Implementation part 9

  • Post author:
  • Post category:Blog

 

Exercise-008:Implementation part 9


In this article, let’s test this Exercise 008. Our project is almost completed, but there is one small change we have to make, that is in the tick ISR. 

Implementation part 9
Figure 1. Tick ISR function

In the tick ISR, you call this QF_tickXISR(0) function, and you should call this Clock_Alarm_update_curr_time function for every 100 milliseconds. That’s why I just took one static variable here. 

if(++count == 100U), then I update the current time variable Clock_Alarm_update_curr_time(). And also, I am sending a tick signal(TICK_SIG) or tick event to the ClockAlarm state machine. For that, you can use this QACTIVE_POST_ISR macro given by the framework because we are posting the event from the ISR.

 

And, there will be one more change in the set_curr_time. In the set_curr_time function, the TCCR1B register must be updated like this (as shown in figure 2). So, take care of this code.

TCCR1B = (TCCR1B_CTC_MODE |TCCR1B_PRESCALER_1); 

Implementation part 9
Figure 2. set_curr_time function

I hope you can make these changes. After that, generate the code and retest it on your hardware. And, it should work.

 

FastBit Embedded Brain Academy Courses,

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

 

FastBitLab

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

Leave a Reply