ADwin-Gold
USB / ENET, manual version 3.8, October 2005
29
CO1 Counter Add-On
ADwin
8.4 Operating Mode Impulse Width and Period Width
Measurement
Reference clock
generator
In this operating mode an internal reference clock generator clocks the counter
with a signal frequency of 20 MHz or (after a prescaler) 5 MHz. All counters
have a switch in order to change the signal frequency. The period duration or
pulse width of a square-wave signal at input CLR/LATCH can be measured.
In this mode you have to consider at high frequencies that your
GLOBALDELAY
remains smaller than a signal period, in order to acquire a cycle.
8.4.1 Period Duration Measurement
All four counters can execute period duration measurements.
Fig. 23 – Block diagram of the
CO1
add-on in the mode
"period duration measurement"
In this mode, the counter values are latched into Latch A at every positive edge,
and the previous data are overwritten. The pulse width will be derived from the
counter value difference multiplied by the period duration of the reference clock.
Programming example
Control Registers
32 bit Counter
32 bit Latch A
CLK
EN
CLR
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
ADwin-GOLD
bus
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)
CNT_ENABLE(1)
INIT:
CNT_ENABLE(0)
CNT_CLEAR(1)
CNT_MODE(1)
CNT_INPUTMODE(1)
CNT_SE_DIFF(0)
CNT_SET(0)
. . .
CNT_SET(1)
select single-ended inputs
EVENT:
CNT_READLATCH(1)
. . .
read out latch A
evaluate counter value in process
event loop ...