Function
Presets the count value for the specified channels.
Format
Ret = CntPreset ( Id , ChNo , ChNum , PresetData )
Parameters
Id
[ C, C++ : short] [Python: ctypes.c_short]
Specifies the device ID retrieved from CntInit.
ChNo
[ C, C++ : short *] [Python: ctypes.POINTER(ctypes.c_short)]
Specifies the base address of array which stores the channel number to
preset.
ChNum
[ C, C++ : short] [Python: ctypes.c_short]
Specifies the number of channels which is specified in ChNo array.
PresetData
[ C, C++ : unsigned long *] [Python: ctypes.POINTER(ctypes.c_ulong)]
Specifies the base address of array which stores the data to preset.
Available range of data:
24-bit counter data : 0H - FFFFFFH
32-bit counter data : 0H - FFFFFFFFH
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_BUFF_ADDRESS |
10101 |
Invalid data buffer address. |
CNT_ERR_SYS_CH_NO |
20201 |
Channel number is outside the range. |
CNT_ERR_SYS_CH_NUM |
20202 |
Number of channels 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
None
Remarks
Sets the count value for the specified channels.
Channel number is stored in an array. Preset value is stored in an array.
The corresponding preset values should be stored into it's array in the
order that the channel numbers are stored into it's array.
CNT-3204IN-ETH CNT-3204IN-USB CNT-3204MT-LPE CNT-3208M-PE CNT32-4MT(LPCI) CNT32-8M(PCI) CPI-CNT-3201I |
The preset value is applied to the device at the timing when the CntPreset function is called. |
CNT24-4(PCI)H CNT24-4D(PCI)H CPS-CNT-3202I CPSN-CNT-3201I CPSN-CNT-3201I2 |
Processing differs depending on whether the count is running or stopped. When the count is running, the preset value is applied to the device at the timing when the CntPreset function is called.
When the count is stopped, the preset value is retained inside the driver at the timing when the CntPreset function is called, but it is not applied to the device. The preset value inside the driver is applied to the device when the CntStartCount function is called. |
Example
C, C++ |
Ret = CntPreset( Id ,
&ChNo[0] , ChNum , &PresetData[0] ); |
Python |
Ret = ccnt.CntPreset(
Id , ChNo , ChNum , PresetData ) |
See Also