DioSetIoDirection


Function

Sets I/O direction of I/O ports.

Format

Ret = DioSetIoDirection ( Id , Dir )

Parameters

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

Dir [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]
The I/O direction is specified in port units. *1

D7

D6

D5

D4

D3

D2

D1

D0

 

 

 

 

 

Port2

Port1

Port0

 

 

 

 

 

 

 

0: Input

 

 

 

 

 

 

 

1: Output

Available range: 0 <= Dir <= (the number of ports supported by a device) power 2 - 1

Bit = 0: Input
Bit = 1: Output

*1 In principle, one port is 8 bits, but devices with less than 8 bits treat all bits as port 0.

Return Value

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

Definition

Value

[Dec]

Description

DIO_ERR_SUCCESS

0

Normal completed.

DIO_ERR_SYS_RECOVERED_FROM_STANDBY

7

Execute DioResetDevice function because the device has recovered from standby mode.

DIO_ERR_DLL_INVALID_ID

10001

Invalid ID specified.

DIO_ERR_SYS_NOT_SUPPORTED

20001

This board couldn't use this function.

DIO_ERR_SYS_IODIRECTION

20500

Direction value is out of range.

The others (See also: Details of Error Code)

Remarks

Please use the DioSet8255Mode function for the board with 8255.

Example

Port 0 is used as output.

VB.NET

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

C, C++

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

C#

int Ret;
Ret = dio.SetIoDirection ( Id , 0x00000001 );
 

Python

Ret = ctypes.c_long()
Ret.value = cdio.DioSetIoDirection ( Id , 0x00000001 )
 

See Also

DioGetIoDirection