AioSetDemoDiBit


Function

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

Format

Ret = AioSetDemoDiBit ( Id , DiBitNum , DiBit , DiData )

Parameters

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

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

DiBit [ C, C++ : short * ] [ Python : ctypes.POINTER(ctypes.c_short) ]
Specifies the address of the array that stored the bit 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.

18103

Pointer to DiBit, DiData is NULL

28100

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

28101

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

28102

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

28103

A driver inner error occurred

Remarks

This is a function dedicated to the demo device.

The initial value is 0 (OFF).

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

 

Example

Sets the digital input data 1 (ON) for bit 0 to bit 7.

C, C++

long Ret;
short DiBit[8];
short DiData[8];
short i;
for( i = 0 ; i < 8 ; i++ ){
    DiBit[i] = i;
    DiData[i] = 1;
}
Ret = AioSetDemoDiBit ( Id , 8 , &DiBit[0] , &DiData[0] );
 

Python

Ret = ctypes.c_long()
DiBitType = ctypes.c_short * 8
DiBit = DiBitType()
DiDataType = ctypes.c_short * 8
DiData = DiDataType()
for i in range(8):
    DiBit[i] = i
    DiData[i] = 1
Ret.value = caio.AioSetDemoDiBit ( Id , 8 , DiBit , DiData )
 

See also

AioSetDemoDiByte, AioInputDiBit