NI GPIB-Serial Converter Help

GPIB Initialization Code Using VISA

  • Updated2024-03-18
  • 1 minute(s) read

GPIB Initialization Code Using VISA

#include "visa.h"

int main(void)
{
ViStatus   status;
ViSession  defaultRM;
ViSession  GPIB232;
ViUInt32   retCount;

/* Open Default RM */
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS) {

/* Error Initializing VISA...exiting */
return -1;
}

/* Open up handle to GPIB-RS232/485/422 at GPIB Primary Address 1 */
status = viOpen(defaultRM, "GPIB::1::INSTR", VI_NULL, VI_NULL, &GPIB232);

/* TODO: Add application specific code here */

/* Use device and eventually close it. */
viClose(GPIB232);
viClose(defaultRM);
return 0;
}