AioSetDemoDiByte


Function

This is a function that sets the digital input of the demo device in port.

Format

Ret = AioSetDemoDiByte ( Id , DiPortNum , DiPort , DiData )

Parameters

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

DiPortNum [ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the number of elements in the port number array.

DiPort [ C, C++ : short * ] [ Python : ctypes.POINTER(ctypes.c_short) ]
Specifies the address of the array that stored the port number.

DiData [ C, C++ : short * ] [ Python : ctypes.POINTER(ctypes.c_short) ]
Specifies the address of the array that stored the data.

0

OFF

1

ON

Return values

Ret [ C, C++ : long ] [ Python : ctypes.c_long ]

Return values

Content

0

Normality completion

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.

18123

Pointer to DiPort, DiData is NULL

28120

The value of DiPortNum is outside the designated range of the device being used

28121

The value of DiPort is outside the designated range of the device being used

28122

The value of DiData is outside the designated range of the device being used

28123

A driver inner error occurred

Remarks

This is a function dedicated to the demo device.

One port has 8bit. And all initial values are 0 (OFF).

Please call AioInputDiByte function when you want to confirm the current Digital Input value.

 

Example

Sets the digital input data FH (bit0, bit1, bit2, bit3 ON) for port 0 to port 7.

C, C++

long Ret;
short DiByte[8];
short DiData[8];
short i;
for( i = 0 ; i < 8 ; i++ ){
    DiByte[i] = i;
    DiData[i] = 0xF;
}
Ret = AioSetDemoDiByte ( Id , 8 , &DiByte[0] , &DiData[0] );
 

Python

Ret = ctypes.c_long()
DiByteType = ctypes.c_short * 8
DiByte = DiByteType()
DiDataType = ctypes.c_short * 8
DiData = DiDataType()
for i in range(8):
    DiByte[i] = i
    DiData[i] = 0xF
Ret.value = caio.AioSetDemoDiByte ( Id , 8 , DiByte , DiData )
 

See also

AioSetDemoDiBit, AioInputDiByte