Function
Specifies the callback function called when the event of specified time sampling completion occurs.
Format
Ret =CntSetSamplingCountEvent ( Id , Count , CallBackProc, Param )
Parameters
Id
[C: short] [Python: ctypes.c_short]
Specifies the device ID retrieved from CntInit.
Count [C: unsigned int] [Python: ctypes.c_uint]
Specifies the number of sampling cycles at which to send notification.
A message will be sent to the application each time the specified number
of sampling cycles is completed.
Range:
Count <= (FFFFFFh / Sampling channel number)
CallBack
[C: PCNT_SAMPLING_COUNT_CALLBACK] [Python: PCNT_SAMPLING_COUNT_CALLBACK]
Specifies the address of callback function.
Param
[C: void *] [Python: ctypes.c_void_p]
Specifies the parameter passed to the callback function.
Return Value
Ret [C: long] [Python: ctypes.c_long]
Definition |
Value |
Description |
CNT_ERR_SUCCESS |
0 |
Normal Complete |
CNT_ERR_DLL_INVALID_ID |
10001 |
Invalid ID is specified. |
CNT_ERR_DLL_CALL_DRIVER |
10002 |
Driver cannot be called (failed in ioctl). |
CNT_ERR_SYS_NOT_SUPPORTED |
20001 |
This function can't be used by this device. |
The other errors: (See also: Details of Error Code)
Remarks
It is the function which
accept the interrupt by using the specified time sampling completion interrupt
function of hardware.
After setting the interrupt callback setting, sets the interrupt event,
the callback function is called when the interrupt occurs.
For
Ethernet devices
If communication with the device is lost, the process will
be unregistered and events will no longer be notified.
If you want to perform event notification again, please make
the settings again using this function.
You can check the registration status of the current process
using the CntGetNetCommunicationInfo
function.
Example
C |
Ret = CntSetSamplingCountEvent
( Id , Count , CallBackProc, Param ); |
Python |
Ret = ccnt.CntSetSamplingCountEvent
( Id , Count , CallBackProc, Param ) |
See Also
PCNT_SAMPLING_COUNT_CALLBACK CntGetNetCommunicationInfo