EasyManua.ls Logo

Pendulum CNT-90 - USB Communication (Ex. #4)

Pendulum CNT-90
264 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
USB Communication (Ex. #4)
#include “stdio.h”
#include “visa.h”
#include <time.h>
#define MAX_CNT 200
void Sleep( clock_t Wait );
int main(void)
{
ViStatus Status; // For checking errors
ViUInt32 RetCount; // Return count from string I/O
ViChar Buffer[MAX_CNT]; // Buffer for string I/O
ViFindList fList;
ViChar Desc[VI_FIND_BUFLEN];
ViUInt32 numInstrs;
ViSession defaultRM, Instr;
inti=0;
// Begin by initializing the system
Status = viOpenDefaultRM(&defaultRM);
if (Status < VI_SUCCESS) {
printf (“Failed to initialise NI-VISA system.\n”);
return -1;
}
// Look for something made by Pendulum
Status = viFindRsrc(defaultRM,
“USB?*INSTR{VI_ATTR_MANF_ID==0x14EB}”,
&fList, &numInstrs, Desc);
if (Status < VI_SUCCESS) {
printf (“No matching instruments found.\n”);
return -1;
}
// Open communication with GPIB Device
Status = viOpen(defaultRM, Desc, VI_NULL, VI_NULL, &Instr);
if (Status < VI_SUCCESS) {
printf (“Cannot communicate with instrument.\n”);
return -1;
}
// Set the timeout for message-based communication
Status = viSetAttribute(Instr, VI_ATTR_TMO_VALUE, 1000);
// Ask the device for identification
Programming Examples
USB Communication (Ex. #4) 4-11

Table of Contents

Other manuals for Pendulum CNT-90

Related product manuals