- c,c#的支持基于VISA
- 需要安装visa runtime
- 目录
- {megarobo studio}/package/misa/c
- {megarobo studio}/package/misa/c#
C
- visa_adapter
- midevice
- mrq
- C_MRQ
编译到你的系统
- 将misa/c中的.h,.c加入你的工程
- 添加对于 visa.h 的引用路径
- 添加对于 visa32.lib 的依赖路径
- miOpen 打开设备
- 使用vi调用api
例程
static int testDevice()
{
ViSession vi = miOpen( "Device1" );
if ( vi == 0 )
{ return -1; }
viPrintf( vi, "*IDN?\n" );
char buf[64];
int retCount;
miRecv( vi, buf, 64, &retCount );
char intf[64];
MRQ_getLINK_INTFC( vi, intf );
printf( "intf:%s\n", intf );
int switchTime;
MRQ_setSENSORUART_SWITCHTIME( vi, "UART1", "S1", 120 );
MRQ_getSENSORUART_SWITCHTIME( vi, "UART1", "S1", &switchTime );
printf( "sw:%d\n", switchTime );
MRQ_getSENSORUART_SWITCHTIME( vi, "UART1", "S2", &switchTime );
printf( "sw2:%d\n", switchTime );
miClose( vi );
return 0;
}
C#
- visa32
- midevice
- CS_MRQ
- MRQ
编译到系统
- 添加 misa/c#/*.cs
- 创建设备
-
调用设备的方法
例程
static void Main(string[] args)
{
MRQ dev = new MRQ();
dev.miOpen("device1");
string link;
dev.getLINK_INTFC(out link);
UInt32 sTime;
dev.getSENSORUART_SWITCHTIME("UART1", "S1", out sTime);
Console.WriteLine(sTime);
dev.setSENSORUART_SWITCHTIME("UART1", "S1", 130);
dev.getSENSORUART_SWITCHTIME("UART1", "S1", out sTime);
Console.WriteLine(sTime);
dev.getSENSORUART_SWITCHTIME("UART1", "S2", out sTime);
Console.WriteLine(sTime);
dev.setSENSORUART_SWITCHTIME("UART1", "S2", 140);
dev.getSENSORUART_SWITCHTIME("UART1", "S2", out sTime);
Console.WriteLine(link);
}