Function
Registers the called callback function as
an event relative to interval timer occurs.
Format
Ret = AioSetTmCallBackProc ( Id , TimerId , CallBackProc , AiEvent , Param)
Parameters
Id
[ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the ID retrieved from AioInit.
TimerId
[ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the timer ID.
CallBackProc
[ C, C++ : long * ] [ Python : ctypes.POINTER(ctypes.c_long) ]
Specifies the address of the callback function.
TmEvent
[ C, C++ : long ] [ Python : ctypes.c_long ]
The event factor that invoke the callback function is specified from the
following range in the macro or numerical value.
AiEvent has the following meanings in bit, it can be specified by a combination
of these bits.
Event factor |
Macro |
Value |
Event that interval elapses |
TME_INT |
00000001H |
Param
[ C, C++ : void * ] [ Python : ctypes.c_void_p ]
Specifies the address of parameter passed to callback.
If the parameter isn't needed, please set NULL to it.
Return values
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 |
16020 |
The value of TimerId is outside the designated range of the function |
20001 |
This function can't be used by this device |
20002 |
Can
not use while by another device works |
20003 |
Can
not use because another process is using the device |
26020 |
The value of TimerId is outside the designated range of the device being used |
Remarks
This function is used to register the callback function, if any event occurs on device, the callback function will be called.
This function cannot be used on devices without
timer functionality.
If the device is in operation, the function cannot be performed.
If the function AioStopTmTimer is performed, the callback function cannot be called.
You should not execute the functions that start/stop devices operation in the callback routine.
Example
Registers the callback function with the factor of Event that interval elapses.
C, C++ |
long
Ret; |
Python |
Ret
= ctypes.c_long() |
Callback function
Format
Ret = CallBackProc ( Id , Message , wParam , lParam , Param )
Parameters
Id
[ C, C++ : short ] [ Python : ctypes.c_short ]
The ID retrieved from AioInit is passed.
Message
[ C, C++ : short ] [ Python : ctypes.c_short ]
The message ID that cause the invoked callback function is passed.
Message ID is one of the following values.
Analog input message factor |
Macro |
Value |
Interval are satisfied event |
AIOM_TME_INT |
1060H |
wParam
[ C, C++ : long ] [ Python : ctypes.c_long ]
The value of TimerId is passed.
lParam
[ C, C++ : long ] [ Python : ctypes.c_long ]
The parameter peculiar to event is passed.
Event factor |
Parameter |
Event that interval elapses |
None |
Param
[ C, C++ : void * ] [ Python : ctypes.c_void_p ]
The parameter specified in AioSetTmCallBackProc is passed.
If the parameter is specified to NULL, NULL is stored here.