beautypg.com

Controlling the device, Device initialization, Error handling – Dataman 570 Series User Manual

Page 7: Data acquisition loop

background image


Development kit for DATAMAN 570 series

Programmer’s Guide

2. Controlling the device

2.1. Device initialization

First of all, it is necessary to load the driver using thr function LoadDriver.

cm570drv.LoadDriver()

After the driver is loaded, it is possible to initialize the device using the function
InitHardware. This function also returns the information for the calibration data.

Dim CalibOK As Byte
cm570drv.InitHardware(CalibOK)

2.2. Error handling

In case the error occurs, all subsequent calls of functions will fail. Therefore it is
necessary to check if the operations were successful (for example check if the
initialization was successful). Use GetDKError to obtain the error code.

Dim res As integer
res = cm570drv.GetDKError()


In case of an error, it is necessary to reset the error flag (to indicate to the DK, that
the error has been handled). Use ResetDKError function to do so (otherwise no other
function will be successful).

cm570drv.ResetDKError()

2.3. Data acquisition loop

The data acquisition process can be started by calling StartMeasurement function.

cm570drv.StartMeasurement()

After the data acqusition starts, the software must wait until the data is ready in the
device. Use IsDataReady function to check the acquisition status.

res = cm570drv.IsDataReady()
If res = cm570drv.DATA_READY Then
End If


When the data is ready for transfer to the computer (return value DATA_READY), it
is possible to transfer them to the computer using GetData function.

Dim Data(1048576) As TSample
Dim lng As Integer
cm570drv.GetData(Data(0), lng)

- 7 -