CntGetSamplingStatus


Function

Retrieves the sampling status.

Format

Ret = CntGetSamplingStatus ( Id , Status , Err )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from CntInit.

Status [ VB.NET: Integer ] [ C, C++: unsigned long * ] [ C#: out uint ] [ Python: ctypes.POINTER(ctypes.c_ulong) ]
Returns the status information (status, warning).

Status will be "0" when none of the conditions as below.
For example, the sampling has never started, or when a start condition other than software start is set and the start condition is not satisfied.

Definition

Value

Description

CNTS_STATUS_BMSTOP

01H

Indicates that the data transfer to the sampling buffer has completed.
It is used to judge the transfer completion.

CNTS_STATUS_CNTSTART

02H

Indicates that counter sampling has been started.

CNTS_STATUS_CNTSTOP

04H

Indicates that counter sampling has been stopped.

CNTS_STATUS_TRGIN

08H

Indicates that the external start signal has been received.

CNTS_STATUS_OVERRUN

10H

Indicates that external start signal has been received at least twice.
Please ignore it if there is no problem in the specification of external connection signal.


Err
[ VB.NET: Integer ] [ C, C++: unsigned long * ] [ C#: out uint ] [ Python: ctypes.POINTER(ctypes.c_ulong) ]
Returns the error information.

Definition

Value

Description

CNTS_STATUS_FIFOFULL

02H

Indicates that FIFO has been full. The main reason is that the overloaded system can not match to the sampling. It is necessary to take measures such as lower the transfer rate and the system load.

CNTS_STATUS_SGOVERIN

04H

Indicates that the buffer is overflow. The number of data to be transferred exceeds the buffer size. Please enlarge the size of the buffer.

CNTS_STATUS_TRGERR

08H

Indicates that external start signal and external stop signal have been received at the same time. The transfer cannot be done when this status occurred. Please confirm how to input external start signal and external stop signal.

CNTS_STATUS_CLKERR

10H

Indicates that the next clock entered while inputting by external clock.
When this status occurred, the sampling cannot be done by the specified sampling clock. Please try to lower the external clock period.
Moreover, please note that the sampling has been performed once after it is started.
At that time, the error will also occur when the external clock entered.

CNTS_STATUS_SLAVEHALT

20H

Indicates that sampling has been stopped by force by the stop factor from slave. Please confirm the error on slave side.

CNTS_STATUS_MASTERHALT

40H

Indicates that sampling has been stopped by force by the stop factor from master. Please confirm the error on master side.


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

The others: (See also: Details of Error Code)

Remarks

Must check the status after transfer completed. Normally, use the function CntNotifySamplingStop to check transfer completion. But if use this function to check transfer completion, please monitor the status of CNTS_STATUS_BMSTOP.

Example

Retrieves the sampling status.

VB.NET

Dim Ret As Integer
Dim Status As Integer
Dim Err As Integer
Ret = CntGetSamplingStatus ( Id , Status , Err )
 

C, C++

long Ret;
unsigned long Status;
unsigned long Err;
Ret = CntGetSamplingStatus ( Id , &Status , &Err );
 

C#

int Ret;
uint Status;
uint Err;
Ret = cnt.GetSamplingStatus ( Id , out Status , out Err );
 

Python

Ret = ctypes.c_long()
Status = ctypes.c_ulong()
Err = ctypes.c_ulong()
Ret.value = ccnt.CntGetSamplingStatus ( Id , ctypes.byref(Status) , ctypes.byref(Err) )