CO1 Counter Add-On
ADwin
30
ADwin-Gold
USB / ENET, manual version 3.8, October 2005
8.4.2 Impulse Width and Pause Duration Measurements
All 4 counters measure impulse width and pause duration.
Fig. 24 – Block diagram of the
CO1
add-on mode
"impulse width/pause duration"
The counters 1 and 2 have two latches for positive (Latch A) and negative
edges (Latch B). Thus, pulse and pause duration can be evaluated separately
by calculating the differences of the latches.
Programming example
Control Registers
32 bit Latch B
32 bit Counter
32 bit Latch A
CLK
EN
CLR
ADwin-GOLD
bus
Data
Data
Data
LATCH
DIR
Up
ref.-CLK
to f
ref
switches of
other counters
Divider
÷ 4
f
ref
switch
G
20 MHz
CNT
_CLE
A
R
CNT
_S
E
T
(CNT
_
M
O
D
E-
Bit
= 1
)
CNT
_E
NA
B
L
E
4k7
initialization ...
disable counters
clear counter(s)
mode "internal reference clock" with ...
... 20 MHz or
... 5 MHz reference frequency
input CLR/LATCH as LATCH input
enable counter(s)
select single-ended inputs
INIT:
CNT_ENABLE(0)
CNT_CLEAR(1)
CNT_MODE(1)
CNT_INPUTMODE(1)
CNT_ENABLE(1)
. . .
CNT_SET(0)
CNT_SET(1)
CNT_SE_DIFF(0)
EVENT:
CNT_READLATCH(1)
CNT_READFLATCH(1)
. . .
read out latch A
evaluate counter value in process
event loop ...
read out latch B