| libvkdaq VKINGING DAQ Library API Reference |

Loading...
Searching...
No Matches
Continuous collection of current data
Temporary task flow chart

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

Example of Continuous Acquisition Current 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(VkDaqCreateAICurrentChan(taskHandle, "dev1/AIN1", "", VkDaq_Val_SingleEnded, 0.00, 0.02, VkDaq_Val_Amperes, ""));
VkDaqErrChk(VkDaqCfgSampClkTiming(taskHandle, VkDaq_Val_ClkSrc_OnBoardClk, 10000, VkDaq_Val_Rising, VkDaq_Val_ContSamps, 0));
// VkDaq Start Code
VkDaqErrChk(VkDaqStartTask(taskHandle));
printf("Acquiring samples continuously.\n");
while (true) {
// VkDaq Read Code
read = VkDaqGetTaskData(taskHandle, data, 1000, VkDaq_Val_GroupByScanNumber, 1);
if (read > 0) {
printf("Current= %f A\r", data[0]);
fflush(stdout);
}
}
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.
VkDaqCreateAICurrentChan
int32_t VkDaqCreateAICurrentChan(const char *task, const char *chans, const char *reserved1, int32_t terminalConfig, double minVal, double maxVal, int32_t units, const char *reserved2)
Create AI Current 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...