1.把相应的板卡的驱动安装完后,安装研华的设备管理程序.配置板卡的各项基本参数(基址,通道接线方式,范围等参数).并运行自检.正常后,继续如下操作.2.把adsapi32.lib driver.h os.h (include下的)等文件 复制到待开发的项目中去 , 在cvi项目里添加adsapi32.lib文件.3.在源程序中,头部第一条语句添加(安装CVI时一定要安装SDK包)
include <windows.h>
......
include "driver.h"
4.使用CVI调用研华的API函数.
先打开设备.
DRV_DeviceOpen(0, (LONG far *)&Handle_1721_0); //0号设备
关闭:DRV_DeviceClose((LONG far *)&Handle_1721_0);
5.编写AI,AO,DI,DO等用到的子函数,类似VC程序.例:DO
void DO_1721(int Port, int Bit, int State)
{
static PT_DioWriteBit ptDioWriteBit;
ptDioWriteBit.port = Port;
ptDioWriteBit.bit = Bit;
ptDioWriteBit.state = State;
DRV_DioWriteBit(Handle_1721_0, (LPT_DioWriteBit)&ptDioWriteBit);
}
include <windows.h>
......
include "driver.h"
4.使用CVI调用研华的API函数.
先打开设备.
DRV_DeviceOpen(0, (LONG far *)&Handle_1721_0); //0号设备
关闭:DRV_DeviceClose((LONG far *)&Handle_1721_0);
5.编写AI,AO,DI,DO等用到的子函数,类似VC程序.例:DO
void DO_1721(int Port, int Bit, int State)
{
static PT_DioWriteBit ptDioWriteBit;
ptDioWriteBit.port = Port;
ptDioWriteBit.bit = Bit;
ptDioWriteBit.state = State;
DRV_DioWriteBit(Handle_1721_0, (LPT_DioWriteBit)&ptDioWriteBit);
}