Function
Converts the specified channel one time, the conversion data are returned in binary value on the wireless I/O device. This function supports multi-process.
Format
Ret = AioSingleAiSR ( Id , AiChannel , AiData , Timestamp , Mode )
Parameters
Id
[ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the Device ID retrieved from AioInit function.
AiChannel
[ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the channel to be converted.
AiData
[ C, C++ : long * ] [ Python : ctypes.POINTER(ctypes.c_long) ]
Specifies the address of the variable that stores the converted data. The
converted data are stored in binary value.
Resolution of device is 10 bit |
0 to 1023 |
Resolution of device is 12 bit |
0 to 4095 |
Resolution of device is 16 bit |
0 to 65535 |
Timestamp
[ C, C++: unsigned short * ] [ Python : ctypes.POINTER(ctypes.c_ushort)
]
Specify the address of the variable to store the timestamp.
Mode
[ C, C++: unsigned char ] [ Python : ctypes.c_ubyte ]
Specify where to refer to the input data.
Definition |
Value |
Description |
AIONET_MODE_DIRECT |
0 |
Refer to the input data of Terminal. |
AIONET_MODE_AP |
1 |
Refer to the input data of Gateway. |
Return value
Ret [ C, C++ : long ] [ 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 |
10002 |
AIO
driver can't be called |
11420 |
The
value of AiChannel is outside the designated range of the function |
11421 |
Pointer
to AiData is NULL |
20001 |
This function can't be used by this device |
20002 |
Can
not use while by another device works |
21420 |
The value of AiChannel is outside the designated range of the device being used |
21423 |
The channel which isn't being used for the conversion is specified |
Remarks
This function cannot be used on devices without
the analog input function.
If the device is in operation, the function cannot be performed.
To acquire data, there are two methods. One
is acquiring data stored in master unit, the other one is acquiring data
directly from slave unit.
Please refer to the wireless
I/O specification for features of each acquisition method.
For the data acquisition method, when acquiring
the data stored in the master unit, you can acquire the time stamp of
the data stored in the master unit.
The time stamp returns the time since the last update in seconds.
If the time stamp is longer than the update interval of the slave unit,
the data from the slave unit is not reaching the master unit for some
reason.
Please use it to check the validity of the data saved in the master unit.
Example
Converts Channel 0 one time.
C, C++ |
long
Ret; |
Python |
Ret
= ctypes.c_long() |
See also