Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

FormattedIO.ReadBinaryBlockOfByte

I am trying to read binary trace data from RS spectrum analyser.  I have had this working before with VisaNS.dll 13.0.45.167, but NI seem to have introduced changes that mean that my code no longer works.

 

I can use NI MAX to execute the commands manually and get the correct data from the spectrum analyser I am trying to use.

"FORM REAL,32"

"TRAC:DATA? TRACE1"

Read two bytes: #4

Read four bytes: 2004

Read 2005 bytes: ... correct data...

 

Using VB2013 the following command  returns exception "The binary block header was not found in the input stream":

 

Dim byteData(2004) As Byte

Session.FormattedIO.ReadBufferSize = lngBytes + 1               - omitting this command makes no difference.

byteData = Session.FormattedIO.ReadBinaryBlockOfByte()

 

I know that the Session is good as it returns the #4 and 2004 that I get with NI MAX.

 

I have the following references:

- NationalInstruments.Visa.dll - 13.0.45.167

- Ivi.Visa.dll - 5.8.908.0

Any ideas would be gratefully received.

 

0 Kudos
Message 1 of 1
(3,177 Views)