08-09-2018 11:10 PM
thanks
yes,i need to transfer a image file from the instrument to the computer that is about 60k bytes.
08-10-2018 07:29 PM
Have you downloaded the driver for Measurement Studio from this link? http://sine.ni.com/apps/utf8/niid_web_display.model_page?p_model_id=1164
If so, did it come with any example programs that show how to do this?
08-12-2018 09:35 PM
Thank you
First of all, the entire program is designed based on visa32.dll. I don't want to change the way if it is not necessary. Such as "Ivi.Driver.Interop" or "Ivi.Visa.Interop". or visaNS. Especially because of your NI driver and Agilent drive conflicts. This caused us to encounter many problems during development. Use visa32.dll to compare two drivers.
Then, no one knows how to use "ViRead" continuously?
08-13-2018 10:26 AM
Hi
The viRead says that: "Only one synchronous read operation can occur at any one time"
08-13-2018 09:10 PM
Thank you
It turned out to be because of this. So what function can send files to the computer in a subcontracted way? The instrument's buffer is only 4096 bytes at the maximum.
11-17-2018 09:59 AM
Hello,
Your code
If status <> VI_SUCCESS Then
VisaErrorHandler()End If
is not correct if you want to read in several parts: if the reading stops because the buffer gets full (EOI not asserted), then viRead will return VI_SUCCESS_MAX_CNT , you should not consider this as an error but an invitation to repeat the redaing to get the next part of the message. BTW. NI application engineers should know that too 🙂
12-11-2018 01:11 AM
Declare Function viRead Lib "VISA32.DLL" Alias "#256" (ByVal vi As Integer, ByVal Buffer As StringBuilder, ByVal count As Integer, ByRef retCount As Integer) As Integer
A better way is to use "StringBuilder" instead of "String"!When you use .NET!
12-11-2018 05:36 AM
A better way is to use "StringBuilder" instead of "String"!When you use .NET!
There is no difference here: both String and StringBuilder are marshalled via a null-terminated string (LPStr), see: https://docs.microsoft.com/dotnet/framework/interop/default-marshaling-for-strings
therefore your Buffer parameter is equivalent to:
<MarshalAs(UnmanagedType.LPString), Out()>ByVal Buffer As StringBuilder
Note that in both cases you need to provide an extra space for the null-termination. Anyway if your data is an image it is clearer and safer to pass it as a byte array rather than a string, so that there is no termination issue:
<MarshalAs(UnmanagedType.LPArray), Out()> ByVal Buffer As Byte()
12-17-2018 12:24 AM - edited 12-17-2018 12:27 AM
thanks
I've thought about using byte (), but Viread transfers files by "#" marking the length of the file. And it's passed in string format. Now it looks like the file transferred is wrong.
I didn't find out how to set up hexadecimal or Byte transfers in the document. Excuse me, how to deal with it?
12-17-2018 01:34 AM - edited 12-17-2018 01:42 AM
Just now I tried to use Byte (), and the result of transmission is the same as that of Stringbuilder.
There are always "2Courier New" characters in the file.