Hi all NI CVI Wizards
I am using Agilent IO as my coms interface for GPIB and Lan communication. I am trying to communicate w/ an RF source, addressed at GPIB0::19:INSTR. I copied this example (idn.c) directly from the Agilent IO connection expert. See below at bottom.
I ran it in Visual Sutdio 2010 and it worked fine. I then ran it in NICVI 2013 and it fails intermittantly. When stepping through it, gets through the viOpenDefaultRM( (&defaultRM); line but defaultRM is empty. It then crashes on the viOpen(....) sometimes returning a dialog box with :
FATAL RUN-TIME ERROR
Unknown source position, thread id 0x000021AC
A non-debuggable thread caused a 'Unknown' fault at address
0x77C2000C
No source line information is available
Other times it passes and vi contains the address of the RF Source
GPIB0::19::INSTR.
Any ideas on why there is an intermitent behavior using CVI? See program belw.
/*idn.c
This example program queries a GPIB device for an identification string
and prints the results. Note that you must change the address. */
#include <visa.h>
#include <stdio.h>
void main () {
ViSession defaultRM, vi;
char buf [256] = {0};
/* Open session to GPIB device at address 19 */
viOpenDefaultRM (&defaultRM);
viOpen (defaultRM, "GPIB0::19::INSTR", VI_NULL,VI_NULL, &vi);
/* Initialize device */
viPrintf (vi, "*RST\n");
/* Send an *IDN? string to the device */
viPrintf (vi, "*IDN?\n");
/* Read results */
viScanf (vi, "%t", &buf);
/* Print results */
printf ("Instrument identification string: %s\n", buf);
/* Close session */
viClose (vi);
viClose (defaultRM);
}