| libvkdaq VKINGING 数据采集库 API 文档 |

载入中...
搜索中...
未找到
函数
模拟输入触发配置
libvkdaq函数接口 » 触发配置

## 函数
int32_t | VkDaqCfgAnlgEdgeRefTrig (const char *task, const char *triggerSource, int32_t triggerEdge, double triggerLevel, uint32_t reserved)
| 模拟输入触发配置

## 详细描述

## 函数说明

## ◆ VkDaqCfgAnlgEdgeRefTrig()

int32_t VkDaqCfgAnlgEdgeRefTrig | ( | const char * | task,
|  | const char * | triggerSource,
|  | int32_t | triggerEdge,
|  | double | triggerLevel,
|  | uint32_t | reserved
| ) |  |

模拟输入触发配置

注解
  可以使用以下代码读取设备的所有触发源列表.

#include <stdio.h>
#include "libvkdaq.h"
int main(int argc, char* argv[])
{
const char* dev = "dev1";
const char* attrName = "TriggerSourceAvailable";
char attrValue[4096] = { 0 };
int32_t size = sizeof(attrValue);
int32_t result = VkDaqGetDeviceAttribute(dev, attrName, attrValue, size);
printf("TriggerSourceAvailable = %s \n", attrValue);
if (result >= 0) {
printf("Successful\n");
}
else {
printf("Failed\n");
}
return 0;
}
VkDaqGetDeviceAttribute
int32_t VkDaqGetDeviceAttribute(const char *dev, const char *attrName, char attrValue[], int32_t size)
获取设备属性值

数据类型 | 参数 | 说明
--- | --- | ---
`const char*` | `task` | 任务名.
`int32_t` | `triggerSource` | 模拟输入触发信号源, 如: "dev1/AIN1", "dev1/AIN2", "dev1/AIN3", "dev1/AIN4", "dev1/MIN1", "dev1/MIN2"等.
`int32_t` | `triggerEdge` | 触发边沿. 0: 下降沿. 1: 上升沿. 2：低电平. 3：高电平.
`double` | `triggerLevel` | 触发电压. -10.00000000~10.00000000
`uint32_t` | `reserved` | 保留.

返回
  成功时, 返回值 >= 0
  失败时, 返回为负值的错误编号.获取详细信息,请调用 VkDaqGetLastErrorInfo

C语言参考
#include <stdio.h>
#include "libvkdaq.h"
int main(int argc, char* argv[])
{
const char* task = "task1";
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 = VkDaqCfgAnlgEdgeRefTrig(task, "dev1/AIN1", VkDaq_Val_Rising, 1.0, 0);
if (result >= 0) {
printf("Successful\n");
}
else {
printf("Failed\n");
}
return 0;
}
VkDaqCfgAnlgEdgeRefTrig
int32_t VkDaqCfgAnlgEdgeRefTrig(const char *task, const char *triggerSource, int32_t triggerEdge, double triggerLevel, uint32_t reserved)
模拟输入触发配置
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)
创建AI电压通道
VkDaqCreateTask
int32_t VkDaqCreateTask(const char *task)
创建任务
VkDaqCfgSampClkTiming
int32_t VkDaqCfgSampClkTiming(const char *task, int32_t source, double samplingFrequency, int32_t reserved, int32_t sampleMode, int32_t sampsPerChanToAcquire)
设置采样时钟的来源、采样时钟的速率以及要采集或生成的采样数