Function
Sets the factor for count-match event.
Format
Ret = CntSetCountMatchEvent ( Id , ChNo , RegNo , Count , Start )
Parameters
Id
[ C, C++ : short] [Python: ctypes.c_short]
Specifies the device ID retrieved from CntInit.
ChNo
[ C, C++ : short] [Python: ctypes.c_short]
Specifies the channel number which you want to set.
RegNo
[ C, C++ : short] [Python: ctypes.c_short]
Specifies the compare register number.
Allowable range:
Device with high-performance counter : 0 or 1
Device without high-performance counter : Fixed 0
Count
[ C, C++ : unsigned long] [Python: ctypes.c_ulong]
Specify the setting c to comparison register.
Allowable range:
24-bit counter data : 0H <= Count <= FFFFFFH
32-bit counter data : 0H <= Count <= FFFFFFFFH
Start
[ C, C++ : short] [Python: ctypes.c_short]
Specifies whether to start the comparison by one of the following defined
values.
Definition |
Value |
Description |
CNT_MATCH_STOP |
0 |
Mask the interrupt |
CNT_MATCH_START |
1 |
Enable the interrupt |
Return Value
Ret [ C, 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_DLL_CREATE_THREAD |
10005 |
Failed in creating thread. |
CNT_ERR_SYS_USING_OTHER_PROCESS |
20003 |
It cannot perform because the other process is using the device. |
CNT_ERR_SYS_CH_NO |
20201 |
Channel number is outside the range. |
CNT_ERR_SYS_CH_VALUE |
20203 |
Counter value is outside the range. |
The other errors: (See also: Details of Error Code)
Initial Value
The initial value of comparison register is 0.
Remarks
It is the function which accept the
interrupt by using the count-match interrupt function of hardware.
Callback function actually accepts the interrupt.
Callback is specified in CntSetCountMatchCallBackProc.
When
using CPSN-CNT-3201I in combination with CPSN-MCB271-xxx
By using this function, the comparison value of the count that
outputs a one-shot pulse can be set.
However, event notification to the application cannot be performed.
For
CPI-CNT-3201I
Only one process can receive events.
Message cannot be sent to multiple processes from the same
device.
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, C++ |
Ret = CntSetCountMatchEvent
( Id , ChNo , RegNo , Count , Start ); |
Python |
Ret = ccnt.CntSetCountMatchEvent
( Id , ChNo , RegNo , Count , Start ) |
See Also
CntSetCountMatchCallBackProc Count-match CntGetNetCommunicationInfo