| libvkdaq VKINGING DAQ Library API Reference |

Loading...
Searching...
No Matches
Finite N collection of voltage data
Temporary task flow chart

Note
  Steps:
  1.Create task. VkDaqCreateTask
  2.Create voltage channel VkDaqCreateAIVoltageChan
  3.Set sampling clock VkDaqCfgSampClkTiming
  4.Start task VkDaqStartTask
  5.Get task data VkDaqGetTaskData
  6.Stop task VkDaqStopTask
  7.Clear task VkDaqClearTask

Example of Finite N Acquisition Voltage Data Process Diagram

C language reference
#include <stdio.h>
#include "libvkdaq.h"
#define VkDaqErrChk(functionCall) if( VkDaqFailed(error=(functionCall)) ) goto Error; else
int main(void)
{
TaskHandle taskHandle = "VkDaqTaskHandle";
float64 data[1000];
int32 error = 0;
int32 read = 0;
// VkDaq Configure Code
VkDaqErrChk(VkDaqCreateTask(taskHandle));
VkDaqErrChk(VkDaqCreateAIVoltageChan(taskHandle, "dev1/AIN1", "", VkDaq_Val_SingleEnded, -10.0, 10.0, VkDaq_Val_Volts, ""));
VkDaqErrChk(VkDaqCfgSampClkTiming(taskHandle, VkDaq_Val_ClkSrc_OnBoardClk, 10000, VkDaq_Val_Rising, VkDaq_Val_FiniteSamps, 1000));
// VkDaq Start Code
VkDaqErrChk(VkDaqStartTask(taskHandle));
// VkDaq Read Code
read = VkDaqGetTaskData(taskHandle, data, 1000, VkDaq_Val_GroupByChannel, 1);
if (read > 0)
printf("Acquired %d samples.\n", read);
Error:
if (VkDaqFailed(error))
printf("VkDaq Error: %s\n", VkDaqGetLastErrorInfo());
if (taskHandle != 0) {
// VkDaq Stop Code
VkDaqStopTask(taskHandle);
VkDaqClearTask(taskHandle);
}
printf("End of program, press Enter key to quit\n");
getchar();
return 0;
}
VkDaqClearTask
int32_t VkDaqClearTask(const char *task)
Clear task.
VkDaqCreateAIVoltageChan
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.
VkDaqCreateTask
int32_t VkDaqCreateTask(const char *task)
Create task.
VkDaqStartTask
int32_t VkDaqStartTask(const char *task)
Start task.
VkDaqStopTask
int32_t VkDaqStopTask(const char *task)
Stop task.
VkDaqGetLastErrorInfo
const char * VkDaqGetLastErrorInfo(void)
Get the error message of the last execution.
VkDaqGetTaskData
int32_t VkDaqGetTaskData(const char *task, double dat[], int32_t sampsPerChan, int32_t fillmode, double timeout)
Get task data.
VkDaqCfgSampClkTiming
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...