AioSetDioDirection


Function

Sets I/O direction of digital I/O ports.

Format

Ret = AioSetDioDirection ( Id , Dir )

Parameters

Id [ VB.NET : Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
Specifies the device ID retrieved from AioInit.

Dir [ VB.NET : Integer ] [ C, C++ : long ] [ C# : int ] [ Python : ctypes.c_long ]
Specifies the I/O direction of each port.

Dir Port1 (DIO08 to DIO15) Port0 (DIO00 to DIO07)
0x00 Digital Input Digital Input
0x01 Digital Input Digital Output
0x02 Digital Output Digital Input
0x03 Digital Output Digital Output

Return value

Ret [ VB.NET : Integer ] [ C, C++ : long ] [ C# : int ] [ Python : ctypes.c_long ]

Return values

Content

0

Normality completion

7

Execute AioResetDevice function because the device has recovered from standby mode

10001

Invalid Id was specified
Use the Id retrieved from AioInit to specify the Id in this function.

10002

AIO driver can't be called
At first, perform AioInit function.

14040

The value of Dir is outside the designated range of the function

20001

This function can't be used by this device

Remarks

Each port can be set to digital input or digital output.
Before switching the digital I/O direction, make sure that there are no problems with the cable connections.
For example, switching to a digital output while a cable is still connected to the output device can cause voltage level differences and damage.

Specifications based on devices

AIO-163202G-PE
AIO-163202UG-PE
AIO-123202G-PE
AIO-123202UG-PE

Initial value is Dir = 0 (Port0 and Port1 are both Input)

 

※This function cannot be executed if the [E-series settings] jumper on the device is [Use as E-series compatible].

DIO00 - DIO07 are fixed as Input, and DIO08 - DIO15 are fixed as output.

AIO-121602LN-USB
AIO-120802LN-USB

Initial value is Dir = 0 (Port0 and Port1 are both Input)

Devices other than the above

This function cannot be executed.

Example

Port 0 is used as output.

VB.NET

Dim Ret As Integer
Ret = AioSetDioDirection ( Id , &H1 )
 

C, C++

long Ret;
Ret = AioSetDioDirection ( Id , 0x00000001 );
 

C#

int Ret;
Ret = aio.AioSetDioDirection ( Id , 0x00000001 );
 

Python

Ret = ctypes.c_long()
Ret.value = caio.AioSetDioDirection ( Id , 0x00000001 )
 

See also

AioGetDioDirection