05-26-2015 02:05 PM
I need an NI4882 equivalent command for the IVI formatted488IO ReadList command.
This is what I have:
using Ivi.Visa.Interop;
using Ivi.Driver.Interop;
formatted488Class = new FormattedIO488();
formatted488Class.WriteString("LDATA");
object response = formatted488Class.ReadList();
What I need is an equivalent when instead of the IVI DLLs (Ivi.Visa.Interop and Ivi.Driver.Interop), I want to use NationalInstruments.Common, NationalInstruments.NI4882 and NationalInstruments.VisaNS.
I.e.:
NI4882.Device.Write("LDATA");
and then call:
NI4882.Device.ReadString() or NI4882.Device.ReadByteArray()
Problem is I don't know how many bytes or strings are to be read, and even if i knew it would not help because it would still not behave the same way as IVI's Readlist.
Can anyone point me in the right direction?
Thanks,
Cris
05-26-2015 07:09 PM
All you need to do is to do is to use NI4882.Device.ReadString();
05-27-2015 09:08 AM
Yes, I was using ReadString. Unfortunately, it only returns 128 values of 1000, which is what I need. If you do not specify the number of values to read, i.e,. ReadString(int numberOfBytes), it assumes a default number of 128. However, I found a solution which is more of a workaround. I read the first 128 values, and it so happens that the instrument returns as a first value the number of values to be read (1000). So I read the rest of the values in a loop. Not elegant, but it seems to work for me.