Visual Basic/LabVIEW applications Sample Clauses
Visual Basic/LabVIEW applications. If the application is written in VisualBasic, LabVIEW, or another high-level programming environment, the consider using the AlazarCreateStreamFile API function. This function creates a binary data file, and enables the API to save each buffer received during an AutoDMA acquisition to this file. The API uses high-performance disk I/O functions that would be difficult to implement in high-level environments like LabVIEW and Visual Basic. As a result, it allows an application in such an environment to perform high-performance disk streaming with a single additional function call. The following code fragment outlines how to write a disk streaming application using AlazarCreateStreamFile: // Allow the API to allocate and manage AutoDMA buffers flags |= ADMA_ALLOC_BUFFERS; // Configure the board to make an AutoDMA acquisition AlazarBeforeAsyncRead( handle, // HANDLE -- board handle channelMask, // U32 -- enabled channel mask -(long)preTriggerSamples, // long -- trigger offset samplesPerRecord, // U32 -- samples per record recordsPerBuffer, // U32 -- records per buffer recordsPerAcquisition, // U32 -- records per acquisition flags // U32 -- AutoDMA mode and options ); // Create a binary data file, and enable the API save each // AutoDMA buffer to this file. AlazarCreateStreamFile(handle, "data.bin"); // Arm the board to begin the acquisition AlazarStartCapture(handle); // Wait for each buffer in the acquisition to be filled RETURN_CODE retCode = ApiSuccess; while (retCode == ApiSuccess) { // Wait for the board to receive sufficient trigger // events to fill an internal buffer. // The API will save the buffer to a binary data file, // but will not copy any data into our buffer. retCode = AlazarWaitNextAsyncBufferComplete( handle, // HANDLE -- board handle NULL, // void* -- buffer to receive data 0, // U32 -- bytes to copy into buffer timeout_ms // U32 -- time to wait for buffer ); } // Abort the acquisition and release resources. // This function must be called after an acquisition. AlazarAbortAsyncRead(boardHandle); See “%ATS_SDK_DIR%\Samples\DualPort\CS_CreateStreamFile” for a full sample program that demonstrates how to stream sample data to disk using AlazarCreateStreamFile.
