Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong reading operation with viRead() - CVI

I am trying to read trace points through a spectrum analyzer (Agilent (HP) 8563E). It is pretty old, by the way.

 

When using the test panel to get the traces, I get all data points from just one click on the "Read" button.

 

However, using C on CVI, I am getting only 11 bytes per reading operation:

 

sprintf(buffer_file,"TDF P;TRA?\n");
status = viWrite(instr, (ViBuf)buffer_file, strlen(buffer_file), &retCount);

/* for (bit = 0; bit < 50; bit++)
{
status = viRead(instr, (ViBuf)buffer_file, strlen(buffer_file), &retCount);
printf("%s\n", buffer_file);
}

 

I tried to put a for loop just to see what happens. When performing successive read operations, I get 11 bytes per reading, while I was expecting to get all traces points by one reading operation. The print screen of the results are attached.

 

Also, I was clearing the buffers before writing/reading.

 

I am using GPIB (VISA). Any help will be appreciated. 

 

Thanks!

 

0 Kudos
Message 1 of 5
(4,919 Views)
It sounds like you have to disable the term character on read property. There are 2 CVI drivers for that instrument. Have you tried either or looked at the source code?

http://sine.ni.com/apps/utf8/niid_web_display.model_page?p_model_id=1916
0 Kudos
Message 2 of 5
(4,903 Views)

Hi Dennis,

 

I tried disabling it, but had no success. I'm actually pretty curious about why it's not working.

 

I got it working with the drivers.

 

Thanks for answering!

0 Kudos
Message 3 of 5
(4,884 Views)

Hi,

 

I am having the same problem with another instrument (ANDO AQ6317B Spectrum Analyzer). When reading the trace, I just get 11 bytes instead of all trace points.

 

Is there any parameter that can limit the number of bytes that are being read? I already disabled the termination character and nothing changes. The termination character used by the instrument is \r\n.

 

Regards,

 

Felipe

0 Kudos
Message 4 of 5
(4,851 Views)
Since the driver for the 8563 works, I can only suggest you look at its source code to see how it's configured. The same setup should work for your new instrument.
0 Kudos
Message 5 of 5
(4,845 Views)