Sampling Completion

Sampling stops in cases when stop condition is satisfied, specified buffer area is filled with transferred data, or compulsive stop is executed in the CntSamplingStop function.

There are the following two methods to confirm that sampling has completed.

 


1. Perform notification by sampling stop event

The sampling completion can be confirmed in the CntSetSamplingStopEvent function by calling the set interrupt event callback function when sampling completed.

Moreover, it is also possible to notify the completion of specified times during sampling in the CntSetSamplingCountEvent function.

 

2. Perform monitoring by polling sampling status

The sampling completion can be confirmed in the CntGetSamplingStatus function by monitoring CNTS_STATUS_BMSTOP and CNTS_STATUS_CNTSTOP for received status.

It is possible to retrieve the current sampling data number in the CntGetSamplingCount function.

 


It is common to both of the two methods, the operation of accessing a device during high-speed sampling will interrupt the sampling. The sampling is temporarily interrupted in cases when interrupt occurred frequently for that the notification number of the CntSetSamplingCountEvent function is small, and the CntGetSamplingStatus function and the CntGetSamplingCount function are called.

When transfer error occurred during high-speed sampling, please enlarge the notification number parameter of the CntSetSamplingCountEvent function, or decreasing the calling frequency of the CntGetSamplingStatus function and the CntGetSamplingCount function.

Before processing sampling data or preparing for the next transfer, be sure to confirm that the transfer has been completed in one of the methods before starting the next process. (The same applies when using CntSamplingStop.)

Other Notes

If the buffer for sampling has been set by CntSamplingSetBuffer function in a thread, when the thread is terminated, memory lock will be released and the sampling will end by forced. Therefore, do not terminate the thread until the sampling has completed.