DIO1 Add-On
ADwin
34
ADwin-light-16
, manual version 2.2, December 2004
Programming example
Pulse width and pause duration measurement
The counters have each a latch A for positive and a latch B for negative edges.
Thus, pulse and pause duration can be evaluated separately by calculating the
differences of the latches.
initialize
disable counter
clear counter
mode internal reference clock at internal CLK
input of the counter ...
... with 20 MHz or
... with 5 MHz
set input CLR/LATCH to LATCH mode
enable counter
read latch A
evaluation in the program
INIT:
CNT_ENABLE(0)
CNT_CLEAR(1)
CNT_MODE(1)
CNT_INPUTMODE(1)
CNT_ENABLE(1)
CNT_SET(0)
. . .
. . .
CNT_SET(1)
EVENT:
CNT_READLATCH(1)
. . .
G
20 or 5 MHz
Control-Registers
32 bit Latch B (#1& #2)
32 bit Counter (#1& #2)
32 bit Latch A (#1& #2)
CLK
EN
CLR
ADwi
n
-li
g
ht-16
bus
Data
Data
Data
LATCH
DIR
Up
4k7