41081 Chapter Notes - Chapter 4: Global Variable, Interrupt
Chapter 4 – Time intervals
Time-Interval Behaviour
• Time-interval behaviour is system functionality where events must be separated by
specified intervals of real time.
• A tie iterval a e related to a eedded sste’s iput i additio to its
output.
Synchronous SMs
• The tick rate of an SM can be set to a specific time interval, known as the period.
• SMs with a specific period are known as synchronous SMs.
• In between ticks, the system is inactive. During this time, variables maintain their
values.
Choosing a Period for Different Time Intervals
• Choose the period as the greatest common divisor and then use multiple states to
obtain the actual desired interval. A count function can also be used where a
variable is incremented with each state transition.
Microcontrollers with Timers
• A timer is a hardware component that can be programmed to tick at a user-specified
rate.
• When the timer ticks, the hardware interrupts the program execution with an ISR
(Interrupt Service Routine) which will execute the TimerISR function before
resuming the main program.
• TimerSet(period) is used to set the timer duration in milliseconds, and TimerOn()
activates the timer.
• A flag is a global variable used by the program to communicate basic status info.
find more resources at oneclass.com
find more resources at oneclass.com