05-03-2011 06:03 PM
Solved! Go to Solution.
05-04-2011 04:48 PM
Hi xinli,
I was looking at the documentation for this function and it's a little confusing. However, I think you need to pass a pointer to your feedback string, instead of the feedback string itself.
Have a great day,
Chris
05-04-2011 04:52 PM
Chris,
Thanks for the reply.
Would you please give an example how to pass pointer to string?
Regards
Xin
05-05-2011 05:43 PM
Hi Xin,
Check out this article for pointers in VB: http://www.codeproject.com/KB/vbscript/how_to_do_pointers_in_visual_basic.aspx?df=100&forumid=1232&e...
Also, what is the value of your stat variable after the viBufRead() ?
Most devices must have a command sent out over TCP/IP before they will return information. Is this not true for your device?
Have a great day,
Chris
05-05-2011 05:59 PM
Thanks, Chris
I will double check what "stat" is after viBufRead() . I rememer it is a negative number.
This code works before even it is not stable. Once a while is no connection and I need to restart my PC or VNA and finally it will connect. But now it look really dead.
On my PC I have TekVisa and NI-VISA (Tekvisa to control Tektronix equipment and NI-VISA for VNA). A few days ago I ran my VBA code for VNA testing, my code complains some functions not defined. I think when I updated TekVISA a few days ago, TekVISA replaces some dll files from NI_VISA (for example VISA32.dll). Then I install latest NIVISA again (5.0.3), hope to recover my code.
After I add VISA library to my VB code, I got this error message
" VI_NULL : constant expression required" in below command
stat = viOpen(defaultRM, "TCPIP::xx.xx.xxx.xx::5000::SOCKET", VI_NULL, VI_NULL, sesn)
Then I input visa32.bas and the error message is gone. I think install of NI-VISA may put it somewhere than VBA project expects. Now my Ethernet connection is really dead.
Regards
05-06-2011 11:06 AM
Chris,
The "stat" values are as
1) stat = viOpenDefaultRM(defaultRM)
stat=0 defaultRM=58317368
2) stat = viOpen(defaultRM, "TCPIP::10.85.148.61::5000::SOCKET", VI_NULL, 20000, sesn)
stat=0 defaultRM=58317368 sesn=58302528
3) stat = viBufRead(sesn, feedbk, Len(feedbk), Actual_Length)
stat= -1073707339 feedbk=" ..."
( I expect the readback value in feedbk is “100 connections accepted”)
According to the equipment programming document, it has no command sent out over TCP/IP before return information.
Thanks
05-06-2011 03:55 PM
Hi Xin,
Is your stat variable a string? From looking at the documentation, it looks like that functions should be returning a string. What you've posted looks like you are representing it as a number.
Have a great day,
Chris
05-06-2011 05:03 PM
Chris,
I define "stat" as Vistatus. " feedbk" is string so I expect see readback string in variable "feedbk"
stat = viBufRead(sesn, feedbk, Len(feedbk), Actual_Length)
Thanks
Xin
05-09-2011 05:07 PM
Hi Xin,
As I said before, the documentation here is a little fuzzy. I'm working with R&D right now to find out exactly what that error code means. I'll get back to you as soon as I hear something.
Have a great day,
Chris
05-09-2011 05:44 PM
Chris,
Thanks for the help.
I checked online for similar problem and found one may help us. You can google it "Problems with the tekvisa_dll in instrument". Their solution is to change equipment IP address. I will give a try and let you know.
Regards
Xin