Function
Sets I/O direction of I/O ports.
Format
Ret = DioSetIoDirection ( Id , Dir )
Parameters
Id
[ C: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from DioInit.
Dir
[ C: long ] [ Python: ctypes.c_long ]
The I/O direction is specified in 8 bits.
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 of 2 - 1
Bit = 0: Input
Bit = 1: Output
Return Value
Ret [ C: long ] [ Python: ctypes.c_long ]
Definition |
Value [Dec] |
Description |
DIO_ERR_SUCCESS |
0 |
Normal complete |
DIO_ERR_DLL_INVALID_ID |
10001 |
Invalid ID is specified. |
DIO_ERR_DLL_CALL_DRIVER |
10002 |
Driver cannot be called (failed in ioctl). |
DIO_ERR_DLL_DIRECTION |
10500 |
I/O direction is outside of the setting range. |
DIO_ERR_SYS_NOT_SUPPORTED |
20001 |
This function cannot be used for this device. |
The other errors: (See also: Error code details)
Initial Value
The default setting is that all ports are set to input at system startup.
Remarks
Please use the DioSet8255Mode function for
the board with 8255.
The device supported by this function is DIO-24DY-USB.
Example
C |
Ret = DioSetIoDirection
( Id , Data ); |
Python |
Ret = cdio.DioSetIoDirection
( Id , Data ) |
See Also