From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

VB.net GPIB read is limited to 1024 characters. How can I read from instrument more than 1024 characters?

Solved!
Go to solution

I used the sample vb program included with NI4882 drivers and the maximun size of the read command is 1024 characters. How can I read more than 1024 characters?

0 Kudos
Message 1 of 7
(10,073 Views)

Hello rjj5

      According to this website and IEEE protocol.   The expected buffersize of many serial devices in 1kByte of information.   This means that you can only gurantee the safe transfer of that much data at any given time.   You can break your data read and data write functions into smaller pieces in order to send more data than just 1kByte,   but for one packet of information I would stay within the 1kByte regulation.


Dano D.
National Instruments
Applications Engineer

0 Kudos
Message 2 of 7
(10,059 Views)

Thanks, Dano. The device I am trying  to query returns 8K of data. I was able to make it work with the old vb6 software module by changing the size of the read buffer from 1k to 8k. How would you break the read data into 1kByte? I am using the following:

 

 Dim Temp1 As String

GpibDevice.Write("caltgttable?")
Temp1 = InsertCommonEscapeSequences(GpibDevice.ReadString())

 

thanks,

 

RJJ

0 Kudos
Message 3 of 7
(10,047 Views)

Hello RJJJ,

     Please take a look at the following link,  especially the answer from the wizard Albert Geven  I think this might solve the issue at hand.   I am looking into a way you can change the buffer size on your system.

     http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/GPIB-read-multiple-data-from-instrument-buffe...

Dano D.
Applications Engineering
National Instruments

0 Kudos
Message 4 of 7
(10,042 Views)
Solution
Accepted by topic author rjj5

Hi,

 

Have you tried using ReadByteData

byte[] bytedata;
double[] wavedata;

bytedata = m_device.ReadByteArray(1010);
m_device.Wait(gsf.IOComplete);


wavedata = new double[1000];
                                        
for (int j = 10; j < 1010  ; j++)
                    
{
                       
wavedata[j-10] = Convert.ToDouble(bytedata[j]);
Trace.WriteLine(j + " " + wavedata[j -10]);

}

 

Curt

Message 5 of 7
(10,018 Views)

Thanks, Curt. That worked.

0 Kudos
Message 6 of 7
(9,973 Views)

Hi,

 

The solved method I'm sure works, but an easier solution is to change the default buffer size.

For example use,

GPIBDevice.DefaultBufferSize = 2048

 

This increases from 1024 to 2048.

 

Enjoy,

Brad

0 Kudos
Message 7 of 7
(9,600 Views)