libvkdaq
VKINGING DAQ Library API Reference
 
Loading...
Searching...
No Matches

Functions

int32_t VkDaqGetTaskData (const char *task, double dat[], int32_t sampsPerChan, int32_t fillmode, double timeout)
 Get task data.
 

Detailed Description

Function Documentation

◆ VkDaqGetTaskData()

int32_t VkDaqGetTaskData ( const char *  task,
double  dat[],
int32_t  sampsPerChan,
int32_t  fillmode,
double  timeout 
)

Get task data.

dat
data type parameter describe
const char* task Task name.
double[] dat[]Task data buffer, its size must be greater than or equal to the number of channels x sampsPerChan.
int32_t sampsPerChan The number of samples, per channel, to read.
int32_t fillmode Specifies whether or not the samples are interleaved.
0: Group by scan number (interleaved).
1: Group by channel (non-interleaved)
double timeout The waiting time for the function to read the sample (in seconds, double type, can be set within one second).

Returns
On success, return value >= 0, indicating the actual number of samples read by each channel
For example, the number of samples to be read for each channel (sampsPerChan) is 1000, and the number of channels is 8. The size of the provided task data buffer (dat []) must be ≥ 1000 * 8. Running successfully returns 1000 (actual number of samples), data has been written to the buffer
On failure, returns a negative error number.For detail, please Call VkDaqGetLastErrorInfo

C language reference

#include <stdio.h>
#include "libvkdaq.h"
int main(int argc, char* argv[])
{
const char* task = "task1";
float64 data[1000];
int32_t result = VkDaqCreateTask(task);
result = VkDaqCreateAIVoltageChan(task, "dev1/AIN1", "", VkDaq_Val_SingleEnded, -10.0, 10.0, VkDaq_Val_Volts, "");
result = VkDaqCfgSampClkTiming(task, VkDaq_Val_ClkSrc_OnBoardClk, 10000, VkDaq_Val_Rising, VkDaq_Val_FiniteSamps, 1000);
result = VkDaqStartTask(task);
result = VkDaqGetTaskData(task, data, 1000, VkDaq_Val_GroupByChannel, 1);
if (result >= 0) {
printf("Acquired %d samples.\n", result);
printf("Successful\n");
}
else {
printf("Failed\n");
}
return 0;
}
int32_t VkDaqCreateAIVoltageChan(const char *task, const char *chans, const char *reserved1, int32_t terminalConfig, double minVal, double maxVal, int32_t units, const char *reserved2)
Create AI Voltage Channel.
int32_t VkDaqCreateTask(const char *task)
Create task.
int32_t VkDaqStartTask(const char *task)
Start task.
int32_t VkDaqGetTaskData(const char *task, double dat[], int32_t sampsPerChan, int32_t fillmode, double timeout)
Get task data.
int32_t VkDaqCfgSampClkTiming(const char *task, int32_t source, double samplingFrequency, int32_t reserved, int32_t sampleMode, int32_t sampsPerChanToAcquire)
Set the source of the sampling clock, the rate of the sampling clock, and the number of samples to be...