| libvkdaq VKINGING DAQ Library API Reference |

Loading...
Searching...
No Matches
View configuration task parameters
Create routine task

Note
  Steps of Method 1:
  1. Read the task name, read the task property "Name", and use the function:
     VkDaqGetTaskAttribute
     2.Read the task channel, read the task attribute 'Channels', and use the function: VkDaqGetTaskAttribute
     3.Read the sampling rate, read the task property 'SamplingFrequency', and use the function: VkDaqGetTaskAttribute
     Supports two ways to obtain detailed configuration information, but both require parsing in JSON forma
     Steps of Method 1:
     1.Open the assistant and enter the interface for creating regular tasks.
     2.Export regular tasks
     3.Open in text format
     4.Parse JSON format to obtain configuration information
     Steps of Method 2:
     1.Read task attribute: 'Detail', use function: VkDaqGetTaskAttribute
     2.Parse JSON format to obtain configuration information

Assistant exports regular task configuration JSON data Process Diagram

Key Name | Data Type | Parameter Description
--- | --- | ---
`task_name` | `String` | Task name Example: TestTask
`task_transmission_mode` | `String` | Transmission mode: online: Online acquisition mode
`offline_task_args` | `String` | Not supported yet
`task_io_mode` | `String` | DAQ card mode: input: Input mode, performs ADC acquisition output: Output mode, performs DAC output
`task_related_devices` | `String` | Hardware devices related to the task Example: dev1 Note: A task can support multiple devices
`feature_channel_list` | `String Array` | Device channels and their configurations related to the task Note: A task can support different channels from multiple devices
`device_name` | `String` | In channel configuration, the hardware device name corresponding to the channel
`channel_name` | `String` | In channel configuration, the channel name
`feature_name` | `String` | In channel configuration, the physical measurement type of the channel voltage: Voltage current: Current accel: Acceleration fullbridge: Full Bridge
`feature_channel_args` | `String Array` | In channel configuration, the specific parameters for the channel Note: Different physical measurement types have different parameters
`terminal_config` | `int` | In channel configuration, the input terminal configuration for the channel 0: Single-ended 1: Differential
`min_value` | `int` | In channel configuration, the expected minimum measurement value for the channel
`max_value` | `int` | In channel configuration, the expected maximum measurement value for the channel
`unit` | `int` | In channel configuration, the unit for the channel In voltage mode: 0: V In current mode: 0: A 1: mA In accel mode: 0: mV/g, mV/N. 1: m/s^2. 2: in/s^2. 4: V.
`sensitivity` | `int` | In channel configuration, the sensitivity of the channel
`task_clock` | `String Array` | Task sampling clock configuration
`source` | `int` | Clock source 0: Internal clock. 1: External sync pulse. 2: Master-slave mode.
`sample_rate` | `int` | Sampling rate
`sample_mode` | `int` | Sampling mode 0: Continuous acquisition 1: N samples acquisition
`sample_count` | `int` | Number of points (N) for N samples acquisition mode
`task_trigger` | `String Array` | Task trigger configuration
`trigger_type` | `String` | Trigger type "none": No trigger "analog_edge": Analog trigger "digital_edge": Digital trigger
`trigger_edge` | `int` | Trigger edge 0: Falling edge 1: Rising edge 2: Low level 3: High level (Note: Original had '1' listed twice, assuming 3 for High Level)
`trigger_level` | `double` | Trigger level Valid only under analog trigger condition
`pretrigger_sample_size` | `int` | Pre-trigger sample count The number of points to acquire before the trigger event

C language reference
#include <stdio.h>
#include "libvkdaq.h"
#define TASKNAMEMAX 4096
#define VkDaqErrChk(functionCall) if( VkDaqFailed(error=(functionCall)) ) goto Error; else
int main(void)
{
char taskNames[TASKNAMEMAX];
char firstTask[TASKNAMEMAX];
int32 error = 0;
// Read the current configured task name
VkDaqErrChk(VkDaqGetTasks(taskNames,TASKNAMEMAX));
printf("taskNames: [%s]\n",taskNames);
// Select the first task read
comma = strchr(taskNames, ',');
size_t len;
if (comma == NULL) {
len = strlen(taskNames);
}
else {
len = (size_t)(comma - taskNames);
}
if (len >= sizeof(firstTask)) {
len = sizeof(firstTask) - 1;
}
memcpy(firstTask, taskNames, len);
firstTask[len] = '\0';
printf("firstTask= %s\n", firstTask);
// Optional: Read the properties of the current task.
// 1. String types: trigger type, sampling rate, number of channels, input type.
// 2. Detailed configuration of JSON format tasks
VkDaqErrChk(VkDaqGetTaskAttribute(firstTask, "Attributes", TaskConfigValue, TASKNAMEMAX));
printf("Attributes= %s\n", TaskConfigValue);
VkDaqErrChk(VkDaqGetTaskAttribute(firstTask, "Name", TaskConfigValue, TASKNAMEMAX));
printf("Name= %s\n", TaskConfigValue);
VkDaqErrChk(VkDaqGetTaskAttribute(firstTask, "Channels", TaskConfigValue, TASKNAMEMAX));
printf("Channels= %s\n", TaskConfigValue);
VkDaqErrChk(VkDaqGetTaskAttribute(firstTask, "ChannelsAvailable", TaskConfigValue, TASKNAMEMAX));
printf("ChannelsAvailable= %s\n", TaskConfigValue);
VkDaqErrChk(VkDaqGetTaskAttribute(firstTask, "Mode", TaskConfigValue, TASKNAMEMAX));
printf("Mode= %s\n", TaskConfigValue);
VkDaqErrChk(VkDaqGetTaskAttribute(firstTask, "SamplingFrequency", TaskConfigValue, TASKNAMEMAX));
printf("SamplingFrequency= %s\n", TaskConfigValue);
VkDaqErrChk(VkDaqGetTaskAttribute(firstTask, "Detail", TaskConfigValue, TASKNAMEMAX));
printf("Detail= %s\n", TaskConfigValue);
Error:
if (VkDaqFailed(error))
printf("VkDaq Error: %s\n", VkDaqGetLastErrorInfo());
printf("End of program, press Enter key to quit\n");
getchar();
return 0;
}
VkDaqGetTaskAttribute
int32_t VkDaqGetTaskAttribute(const char *task, const char *attrName, char attrValue[], int32_t size)
Get task attribute value.
VkDaqGetTasks
int32_t VkDaqGetTasks(char tasks[], int32_t size)
Get task.
VkDaqGetLastErrorInfo
const char * VkDaqGetLastErrorInfo(void)
Get the error message of the last execution.