Function
Sets the sampling buffer.
Format
Ret = CntSamplingSetBuffer ( Id , Buffer , ChNum , ScanNum , IsRing )
Parameters
Id
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify the device ID retrieved from CntInit.
Buffer
[ VB.NET: IntPtr ] [ C, C++: unsigned long * ] [ C#: IntPtr ] [ Python:
ctypes.POINTER(ctypes.c_ulong) ]
Specify the base address of buffer.
ChNum
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify the number of channels in buffer.
ScanNum
[ VB.NET: Integer ] [ C, C++: unsigned long ] [ C#: uint ] [ Python: ctypes.c_ulong
]
Specify the scan number of buffer.
Device Name |
Available Range |
||||||
CNT-3204IN-USB |
ChNum(number of channels) * ScanNum(number of data) * 4Byte(data unit) <= 64MByte |
||||||
CNT32-8M(PCI) |
These
devices implement bus master transfers with a 32-bit bus width.
|
*Depending on how the physical address space is mapped, it may not be possible to set the bus master buffer size up to the maximum area.
IsRing
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Sets whether the buffer is used once per transfer, or is used as a ring
buffer.
Definition |
Value |
Description |
CNTS_WRITE_ONCE |
0 |
Once transfer |
CNTS_WRITE_RING |
1 |
Infinite time transfer |
Return Value
Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]
Definition |
Value |
Description |
CNT_ERR_SUCCESS |
0 |
Normality completion |
CNT_ERR_SYS_RECOVERED_FROM_STANDBY |
7 |
Execute the function CntResetDevice to return from the standby mode. |
CNT_ERR_DLL_INVALID_ID |
10001 |
Invalid ID was specified. |
CNT_ERR_DLL_CALL_DRIVER |
10002 |
CNT driver can't be called (Failed in the device I/O control). |
CNT_ERR_DLL_BUFF_ADDRESS |
10101 |
Invalid data buffer address. |
CNT_ERR_SYS_MEMORY |
20000 |
It failed in memory allocation for the object preparation. |
CNT_ERR_SYS_NOT_SUPPORTED |
20001 |
This function can't be used by this device. |
CNT_ERR_SYS_USING_OTHER_PROCESS |
20003 |
Cannot use because another process is using the device. |
CNT_ERR_SYS_BUFFER |
21100 |
Because the buffer was too large, it was not possible to secure it. |
CNT_ERR_SYS_LOCK_MEMORY |
21101 |
The memory cannot be locked. |
CNT_ERR_SYS_SEQUENCE |
21102 |
Execution procedure error |
The others: (See also: Details of Error Code)
Remarks
Execute the buffer setting before transfer starts every time.
For devices with the
bus master transfer function, in the specification of hardware, the buffer
size can be set up to 64MByte,
depending on how the buffer area maps to physical address space, 64MByte
area maybe cannot be set,
63MByte becomes the real upper limit.
For USB devices, depending on the memory status of system, there is a possibility that 64MByte area can not be set.
The execution procedure
error occurs when this function is executed in sampling.
Execute it after confirming sampling was completed.
Example
Sets the buffer for 10000 data to channel 0. The buffer is used for the infinite transfer.
VB.NET |
Refer to Note
of Using Visual Basic .NET |
C, C++ |
long Ret; |
C# |
Refer to Note
of Using Visual C# |
Python |
Ret = ctypes.c_long() |
See Also