Hardware Reference
In-Depth Information
T
Δ T
Δ T
T
Duty cycle =
× 100%
Figure 8.13 Definition of duty cycle
Phase difference measurement . The phase difference is defined as the difference of
arrival times (in percentage of a period) of two signals that have the same frequency
but do not coincide in their rising and falling edges. The definition of the phase
difference is illustrated in Figure 8.14.
T
Signal S1
Δ T
Signal S2
Δ T
T
×
360°
Phase difference =
Figure 8.14 Phase difference definition for two signals
The unit used in most of the measurements is the number of clock cycles. When it is desir-
able, the unit should be converted into an appropriate unit, such as seconds.
Example 8.2
Period measurement. Use the input-capture channel 0 to measure the period of an unknown
signal. The period is known to be shorter than 128 ms. Assume that the E-clock frequency is
24 MHz. Use the number of clock cycles as the unit of the period.
Solution: Since the input-capture register is 16-bit, the longest period of the signal that can be
measured with the prescaler to TCNT set to 1 is
2 16 4 24 MHz 5 2.73 ms
To measure a period that is equal to 128 ms, we have two options.
1. Set the prescale factor to 1 and keep track of the number of times that the timer
counter overflows.
2. Set the prescale factor to 64 and do not keep track of the number of times that the
timer counter overflows.
In this example, we adopt the second approach to make the programming easier. The result
of this measurement is in number of clock cycles, and the period of each clock cycle is 2.67
μ
s.
 
 
Search WWH ::




Custom Search