05-15-2018 11:16 PM
if use viVScanf or viVQueryf like:
status = viVScanf(vi, "%t", strRes)
status = viVQueryf(vi, ":MMEM:DATA? 'FILE.WMF'“ + vbCrLf, "%t", strRes)
Sometimes the result is empty, and sometimes the result is “#572676淄茪”
05-16-2018 07:08 AM
@xiaochouyu wrote:
and sometimes the result is “#572676淄茪”
Agilent/Keysight instrument? That format looks like something they use. That # is the start of the data block. Then the next character tells you how many characters the length is. In this case, it tells me there are 5 characters for the length: 72676.
So what you need to do to read this is to read 2 bytes. Remove the # and do a Val() on the second character. Then read that many characters and do a Val() on those. Now you read that many characters to get the actual data in the hard copy.
NOTE: Also make sure you have any termination characters turned OFF for this process. You can turn it back on when you are done reading the data block.
05-16-2018 09:00 PM
Thank you for your reply
In my source code you can see I had used
05-16-2018 10:55 PM
I thought you have incorrect Terminator setting.
May check the IO Trace log.
YY
05-17-2018 09:20 PM
thank you
now i can't use I/O Trace
when i install NI-VISA RUNTIME , My VISA program can't connection instrument.
when i install IO library , When running NI I/O Trace I get the error "visa32.dll is not built for NI I/O Trace.
How to solve the problem of the conflict between“NI-VISA” and “IO library”?
05-17-2018 09:30 PM
I would like to suggest to use the latest version of IO Library and NI-VISA.
My experence, a system has 2 visa will cause a lot of unexpected results. However, this is normal in real life.
05-17-2018 09:56 PM
thank you
I'm puzzled that the function should be the same, though the source of visa32.dll is different.
this is my Declare:
Declare Function viOpenDefaultRM Lib "VISA32.DLL" (ByRef sesn As Integer) As Integer
Declare Function viOpen Lib "VISA32.DLL" (ByVal sesn As Integer, ByVal viDesc As String, ByVal mode As Integer, ByVal timeout As Integer, ByRef vi As Integer) As Integer
Why can't be used in NI_VISA. NI_VISAshould be more standard
05-17-2018 11:13 PM
A new discovery is that under condition NI-VISA mode , I can connect through TCPIP, but I can't connect through GPIB.
PS: The linker I used is GPIB to USB.
05-18-2018 04:04 AM
the data size is 72676kb,but only read out 4096kb.So I think the <block>size only 4096kb.
So the problem solution should be how to read <block> continuously .
I continuous use "viread ",but only first work.
05-18-2018 04:20 AM
hi:
I found that I can only read the maximum of 4096kb using “viread”.So I think the max block size of instrument can only be 4096kb.
status = viReadToFile(vi, "D:\YouName.WMF", 72676, retCount)
the result is retCount = 4096
I continuous use "viread ",but only first work.
How to read block data continuously?
status = viVPrintf(vi, ":SYST:COMM:GPIB:RTER EOI" + vbCrLf, 0)
status = viVPrintf(vi, ":HCOP:DEV:LANG WMF" + vbCrLf, 0)
status = viSetAttribute(vi, VI_ATTR_TMO_VALUE, 20000)
status = viVPrintf(vi, ":HCOP:DEST1 'MMEM'" + vbCrLf, 0)
status = viVPrintf(vi, ":MMEM:NAME 'C:\USER\DATA\FILE.WMF'" + vbCrLf, 0)
status = viVPrintf(vi, ":HCOP" + vbCrLf, 0)
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 = 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 = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)
status = viReadToFile(vi, "D:\YouName.WMF", 4096, retCount)