IP482 Industrial I/O Pack User’s Manual Counter Timer Module
__________________________________________________________________
_________________________________________________________________________________________
Acromag, Inc. Tel:248-295-0310 Fax:248-624-9234 Email:[email protected] http://www.acromag.com
42
3. Do
not
write to either of the Counter 7 Constant Registers. They are not
required for frequency measurement and writing to them can cause errors.
4. The following is a waveform diagram of this example.
i
Output
InB
InC
InA
Interrupts
The frequency of the signal is calculated by dividing the value in the
Counter 7 Read Back Register, located at base address plus an offset of
28H, by the duration of the InA enable signal. Note that the value in the
Read Back Register is stored in Hex and requires conversion to decimal for
calculations. In this case the pulse length is 50
s. The value in the Read
Back Register is 9, since there were nine high pulses during the enable
signal. Therefore, the frequency is 9/50
s, which is equal to 180KHz.
Note that the counter must be re-triggered before the next frequency
measurement can take place. Additionally, the output pulse is active for
1.75
s. Since debounce was enabled the output pulse will occur 2.5
s after
the completion of the enable signal. For further information, see the
Frequency Measurement Operation description.
Input Pulse-Width Measurement Example
The objective for this example is to use the Pulse-Width Measurement
Operation using 16-bit Counter 9. The pulse to be measured is active low.
Additionally the counter has an external clock and an active low External
Trigger. The output of the counter is active high and interrupts are enabled.
Assume the external clock has a frequency of 100KHz.
1. Connect the inputs/output to the following pins (unpowered):
Pin # Connection
Description
9
In9_A(+)
Pulse Input
19
In9_B(+)
Ext. Clock
29
In9_C(+)
Ext. Trigger
41
Out9(+)
Output
PROGRAMMING
EXAMPLES
Figure 3.6:
Frequency
Measurement waveform
In the figure each “i”
represents an interrupt
Table 3.28:
Pulse-Width
Measurement Pin
Assignments for Counter 9
Note: Make sure all inputs
and outputs are properly
grounded.