Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use GPIB to transmit a large picture?

Solved!
Go to solution

 status = viVPrintf(vi, ":SYST:COMM:GPIB:RTER EOI" + vbCrLf, 0)

status = viSetAttribute(vi, VI_ATTR_TMO_VALUE, 20000)

status = viVPrintf(vi, ":MMEM:MSIS 'C’" + vbCrLf, 0)

status = viVPrintf(vi, ":MMEM:CDIR '\USER\DATA\'" + vbCrLf, 0) 
status = viVPrintf(vi, ":MMEM:DATA? 'FILE.WMF'" + vbCrLf, 0) 

status = viRead(vi, strRes, 72676, retCount)

FileOpen(1, Application.StartupPath + "\FILE.WMF", OpenMode.Output)
Print(1, strRes)
FileClose(1)

 

 

"C:\USER\DATA\FILE.WMF" on the instrument, it should be transmitted to the computer, saved as "\FILE.WMF".The result is only 4096 bytes!!!!!

The file start by #560376淄茪 ?? 

 

0 Kudos
Message 1 of 3
(2,182 Views)
Solution
Accepted by topic author xiaochouyu

Dim fanal As String

For i = 0 To x + y + 1
fanal = fanal & "0"

Next

status = viRead(vi, fanal, x + y + 2, retCount) 

FileOpen(1, Application.StartupPath + "\FILE.WMF", OpenMode.Output) '输出文档
Print(1, fanal)
FileClose(1)

 

I don't know why viRead must assign an initial value equal to the length of the result.
Now all the data can be read out. But the new problem is that the file can't be opened. Even if I delete the header file starting with "#", it won't work.

 

 

0 Kudos
Message 2 of 3
(2,164 Views)
Solution
Accepted by topic author xiaochouyu

A better way is to use "StringBuilder" instead of "String"!When you use .NET!

0 Kudos
Message 3 of 3
(2,113 Views)