176 6. TIMER SYSTEMS
example, a sinusoidal signal with the 60 Hz frequency means that a full cycle of a sinusoid signal
repeats itself 60 times each second or once every 16.67 ms.
The reciprocal of frequency is a period. If an event occurs with a rate of 1 Hz, the period of that
event is one second. To ﬁnd a period, given a frequency, or vice versa, we simply need to remember
their inverse relationship f =
where f and T represent a frequency and the corresponding period,
respectively. Both periods and frequencies of signals are often used to specify timing constraints of
embedded systems. For example, when your car is on a wintery road and slipping, the engineers who
designed your car conﬁgured the anti-slippage unit to react within some millisecond period, say 20
milliseconds.The constraint then forces the design team that monitors the slippage to program their
monitoring system to check a slippage at a minimum rate of 50 Hz.
6.5.3 DUTY CYCLE
In many applications, periodic pulses are used as control signals. A good example is the use of a
periodic pulse to control a servo motor. To control the direction and sometimes the speed of a motor,
a periodic pulse signal with a changing duty cycle over time is used. The periodic pulse signal shown
in Figure 6.2 frame (a) is on for 50 percent of the signal period and off for the rest of the period.
The pulse shown in frame (b) is on for only 25 percent of the same period as the signal in frame (a)
and off for 75 percent of the period. The duty cycle is deﬁned as the percentage of one period a
signal is on. Therefore, we call the signal in frame (a) in Figure 6.2 as a periodic pulse signal with
a 50 percent duty cycle and the corresponding signal in frame (b), a periodic pulse signal with a 25
percent duty cycle.
6.5.4 PULSE WIDTH MODULATION
In this subsection, we show how the speed of a DC motor can be controlled by a pulse width
modulated (PWM) signal. Suppose you have the circuit setup shown in Figure 6.3. The ﬁgure
shows that the batteries are connected to power the motor through a switch. It is obvious that when
we close the switch the DC motor will rotate and continue to rotate with a set speed proportional
to the DC voltage provided by the batteries. Now suppose we can open and close the switch rapidly.
It will cause the motor to rotate and stop rotating per the switch position. As the time between the
closing and opening of the switch decreases, the motor will not have time to make a complete stop
and will continue to rotate with a speed proportional to the time the switch is closed. This is the
underlying principle of controlling DC motor speed using the PWM signal. When the logic of the
PWM signal is high, the motor is turned on, and when the logic of the waveform is low, the motor
is turned off. By controlling the time the motor is on, we can control the speed of the DC motor.
The duty cycle is deﬁned as the fractional time the logic is high with respect to one cycle time of the
PWM signal. Thus, 0% duty cycle means the motor is completely turned off while 100% duty cycle
means the motor is on all the time. Figure 6.4 shows two signals with 25% duty cycle and 75 % duty