ADwin-Gold II
, Manual February 2013
131
SSI interface
SSI_Read
ADwin
SSI_Read
SSI_Read
returns the last saved counter value of a specified SSI counter.
Syntax
#Include
ADwinGoldII.inc / GoldIITiCo.inc
ret_val
=
SSI_Read
(
dcdr_no
)
Parameters
Notes
An encoder value is saved when the bits indicated by
SSI_Set_Bits
are read.
See also
,
,
Valid for
Gold II-CNT
Example
Rem Please select the appropriate include for ADbasic /
TiCoBasic
#Include
ADwinGoldII.inc / GoldIITiCo.inc
Rem Decoder 1 runs with 500 kHz
Dim
m
,
n
,
y
As
Long
Init:
SSI_Set_Clock
(
1
,
50
)
'clock rate for decoder 1
SSI_Mode
(
1
)
'Set continuous-mode (encoder 1)
SSI_Set_Bits
(
1
,
23
)
'23 encoder bits for encoder 1
Event:
Par_1
=
SSI_Read
(
1
)
'Read out positio
n
value
'
(
e
n
coder
1
)
REM Cha
n
ge value from Gray-code into a binary value:
m
=
0
'delete value of the last
'conversion
y
=
0
' -"-
For
n
=
1
To
32
'Check all 32 possible bits
m
=
(
Shift_Right
(
Par_1
,(
32
-
n
))
And
1
)
XOr
m
y
=
(
Shift_Left
(
m
,(
32
-
n
)))
Or
y
Next
n
Par_9
=
y
'The result of the Gray/binary
'conversion in Par_9
T11 TiCo
dcdr_no
Number (1…4) of the SSI decoder whose counter
value is to be read.
LONG
ret_val
Last counter value of the SSI counter (= absolute
value position of the encoder).
LONG