ADwin-Gold II
, Manual February 2013
97
Digital Inputs and Outputs
Digin_Long
ADwin
Digin_Long
Digin_Long
returns the value of the digital inputs DIO00…DIO31.
Syntax
#Include
ADwinGoldII.inc / GoldIITiCo.inc
ret_val
=
Digin_Long
()
Parameterss
Notes
For any digital channel configured as output
Digin_Long
will return an
undefined value.
Digital channels are configured as inputs after start-up. (And thus cannot
be accessed as outputs yet). Channels can be configured as inputs or
outputs in groups of 8.
Conf_DIO
configures digital channels as inputs or outputs in groups of
8. A standard configuration is
Conf_DIO
(
1100b
)
which specifies
DIO00…DIO15 as inputs and DIO16…DIO31 as outputs.
It is preferable to use a binary code (suffix "b") for the bit pattern. This
will make it easier to display the bit pattern than if you use a decimal or
hexadecimal representation although it is still possible to use these.
See also
,
Valid for
Gold II
Example
Rem Please select the appropriate include for ADbasic / TiCoBasic
#Include
ADwinGoldII.inc / GoldIITiCo.inc
Dim
Data_1
[
10000
]
As
Long
As
FIFO
Init:
Rem Configure all channels As inputs
Conf_DIO
(
0000b
)
Event:
Rem Is digital input DIO17 set?
If
((
Shift_Right
(
Digin_Long
(),
17
)
And
1
)
=
1
)
Then
Data_1
=
ADC
(
1
)
'get measurement value
EndIf
T11 TiCo
ret_val
Bit pattern that corresponds to the TTL-levels at
the digital inputs (see table).
1: TTL-level high.
0: TTL-level low.
LONG
Bit no. in
r e t _
val
31
30
…
1
0
Channel
DIO31 DIO30
…
DIO01 DIO00