ADwin-Gold
USB / ENET, manual version 3.8, October 2005
25
CO1 Counter Add-On
ADwin
On the option Gold-D you can – via the connector
CO
Power
in
– supply a volt-
age, which is then available at the connectors
CO1
…
CO4
, e.g. for external
Inkrementalgeber.
Please note: All minus inputs V1
in
(-) are galvanically connected to GND via a
common line; the minus inputs V2
in
(-) have such a common connection, too.
Fig. 18 – Pin assignment counter voltage supply (Gold-D)
8.2 Software
The functions necessary for accessing the counters can be found in the include
file:
<ADWGCNT.INC>
Therefore programming has to start with the include file, so that you can use the
instructions in the following table. The instructions are described in the
ADba-
sic
manual.
Fig. 19 – Instructions of the
Gold-CO1
counter add-on
With the instructions in the table matrix you are always effecting
all
counters
(except
CNT_READ…
). Therefore pay attention to the fact which bits you are set-
ting or deleting. You will be able to effect every counter individually or all
together.
Sequence of instructions
Please configure the counters according to the following order:
1. Disable specified counter (
CNT_ENABLE
)
2. Set operating mode (
CNT_MODE
,
CNT_SET
,
CNT_INPUTMODE
,
CNT_SE_DIFF
)
3. Clear counter (
CNT_CLEAR
)
4. Enable counter (
CNT_ENABLE
)
Instruction
Function
CNT_CLEAR()
*
Clear counter
CNT_ENABLE()
Disable or enable counter
(please note the already running counters)
CNT_GETSTATUS(#)
Read out status register (# = counter no. 1…4)
CNT_INPUTMODE()
Set CLR/LATCH input to CLR or LATCH mode
CNT_LATCH()
*
Latch counter values into Latch A
CNT_MODE()
Use external clock input or internal reference clock
CNT_SE_DIFF()
Set clock inputs to differential or single-ended (as pairs)
CNT_SET()
In combination with
CNT_MODE()
:
Set counter mode or length of the internal reference clock
CNT_READ(#)
Read out counter values and transfer them to Latch A (# = counter no.
1…4)
CNT_READLATCH(#)
Read out Latch A (triggered by positive edge), (# = counter no. 1…4)
CNT_READFLATCH(#)
Read out Latch B (triggered by negative edge), (# = counter no. 1…4)
* These functions are reset after they have been executed. All other functions are reset by opposing functions.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
V1
,2
IN
(-)
V1
,2
IN
(-)
V1
,2
IN
(-)
V2
IN
(+
)
V1
IN
(+
)
V1
IN
(+
)
V1
,2
IN
(-)
V1
,2
IN
(-)
V1
,2
IN
(-)
RESERVED
V2
IN
(+
)
V1
IN
(+
)
V1
IN
(+
)
CO POWER IN
(female)
RESERVED