Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

linux kernel locks with simple ibrd.

Hello,
I have compliled a simple program that sets up the freq. and span. of a
spectrum analyzer and sets the peak marker and reads back the freq and power
of the marker.

Whenever the code gets to the ibrd after the CALC:MARK:Y? the whole linux
kernel hangs.

The ibwrt,ibrd sequence for extracting the frequency of the marker causes no
problems at all.

I did a GPIB trace and the instrument is sending the result of the power
back to the GPIB card on the linux box, but then it hangs.

I am running Red Hat 6.2 linux.
I installed the ni drivers.
everything seemed to configure correctlty.

the code is attached just for reference. pretty simple stuff, but it does
not work. Any ideas??
#include

#include "ugpib.h
"

main(argc,argv)

int argc;

char *argv[];

{

int dev1;

char freq[100];

char ampl[100];

char tempstring[100];

if(argc != 2)

{

printf("usage: spec_meas gpib_id \n");

exit(1);

}

sprintf(tempstring,"%s",argv[1]);

dev1 = ibdev(0,atoi(tempstring),0,12,1,0);

ibwrt(dev1,"CALC:MARK:X?",12);

ibrd(dev1,freq,100);

printf("%s\n",freq);

sleep(3);

ibwrt(dev1,"CALC:MARK:Y?",12);

ibrd(dev1,ampl,100);

printf("%s\n",ampl);

}
0 Kudos
Message 1 of 1
(3,189 Views)