IP482 Industrial I/O Pack User’s Manual Counter Timer Module
__________________________________________________________________
_________________________________________________________________________________________
Acromag, Inc. Tel:248-295-0310 Fax:248-624-9234 Email:solutions@acromag.com http://www.acromag.com
40
Note that the InA and InC inputs run off the internal 8MHz (or 32MHz)
clock. Those signals may not be synchronous with the selected clock. For
further information, see the Watchdog Timer Operation description.
Event Counting Operation Example
The objective for this example is to create an Event Counter that will
count the number of active high events on InB using 16-bit Counter 7. The
output is active low. Additionally the counter has an active low Gate-Off and
an active low External Trigger. After every five events, the event counter
interrupts.
1. Connect the inputs/output to the following pins (unpowered):
Pin # Connection
Description
7
In7_A(+)
Gate-Off
17
In7_B(+)
Event Input
27
In7_C(+)
Ext. Trigger
39
Out7(+)
Output
2. Write the following information, 8194H, to Counter 7
Control Register located at base address plus an offset of 14H.
Bits
Logic
Operation
2,1,0
100
Sets the counter to Event Counting mode.
3
0
Sets the output to active low.
5,4
01
Enable the Gate-Off input (InA) to active low.
7,6
10
Enables the Event input (InB) to active high.
9,8
01
Enables the external Trigger Input (InC) to active low.
12,11,10
000
Sets the counter to Event Counting mode.
13
0
Disables input debounce on InA, InB, and InC.
14
0
Not used.
15
1
Enables interrupts.
3. Write the 16-bit value 5H to Counter 7 Constant A Register located at the
base address plus an offset of 3CH.
In Event Counting, when the Constant A Register is equal to the value in
the Counter 7 Read Back Register, in this case located at base address plus
an offset of 28H, there is an output pulse and an interrupt. Furthermore,
when this condition occurs, the counter resets to zero and starts
incrementing again. For this example, an interrupt and output pulse will
occur every five events. Therefore 5H is written to the Counter 7 Constant
A Register. Note that all values are stored and read in Hex.
PROGRAMMING
EXAMPLES
Table 3.24:
Event Counting
Pin Settings for Counter 7
Note: Make sure all inputs
and outputs are properly
grounded.
Table 3.25:
Event Counter
Control Register 7 Settings
Counter Constant B
Register is not used in
Event Counting mode.