10-17-2018 09:30 PM
I Need to control the instrument use TCP/IP via VISA resource, I have created the VISA resource => "TCPIP0:: 192.168.1.1:: inst0:: INSTR" in the NI MAX, And try to send the SCPI command "*IDN?\n" to instrument, The instrument has responded normally.
But, when I send the same command to the instrument under LabVIEW, use VISA resource, The Error message are shows up after execute the VISA Write component.
I tried to search the other similar talk, such as below link:
LINK
But I still haven't solved the problem.
Attach file is my VI, Have anyone can help me?
Thanks
10-18-2018 04:49 AM - edited 10-18-2018 04:51 AM
You should attach the end characters to the sting you send.
Note the \r\n in max? They are not there in LabVIEW. Make sure to set the string to "'\' Code Display" (right click on the constant, Visible Items>Display Style, then click the new thingy on the left of the constant).
You're telling VISA to not use end characters. I'd enable them, and set them to \n (10). That way, when you read, the reads are automatically truncated on \r\n. Very convenient, and the only alternative is to poll data, concatenate that data, and check for \r\n manually. Not sure why you'd want to do that.
IIRC (it's been a while), the end characters are not attached to the output strings, so you need to attach them to the strings you're sending. Won't hurt to check, or maybe someone else can confirm\contradict that. EDIT: Probably set the Send End... Boolean to true, to send it.
10-18-2018 06:27 AM
You are getting an "Insufficient location information" error. I am assuming all of this was on the same computer, so the instrument should still be there. So first thing I would do is make sure your VISA Test Panel is closed (it might be holding the resource and blocking LabVIEW from getting access to it). After that, try to ping the device (open the Windows command prompt an type "ping 192.168.1.1") and verify you are getting a response.
10-18-2018 06:50 AM
Also, the Wait Until Next ms Multiple seems out of place here.You probably mend to use a Wait (ms)?
It's not needed at all, and undesirable. You'll probably just slow down the program without need. The VISA read has a time out, simply make it larger when needed. The end character will help to make it work.
If the wait is removed, the error case structure can be removed. All nodes in it are skipped when there is an error in.
It's OK in a test VI, but usually you want to put the init, write\read and close in three different VI's. Then open once, write\read unil the program quits, then close once.
10-18-2018 07:04 AM - edited 10-18-2018 07:07 AM
I would leave the timeout at its default value, or at least make it longer than 200 ms. Some commands may take longer to process than that and cause a timeout error.
Edit: Maybe that's 2000 ms but the lightbulb tool tip got cut off, making it look like 200. 2 seconds (and lengthening it temporarily when expecting a command that takes time to process) is probably good enough without becoming a nuisance if there actually was a timeout.
10-22-2018 01:20 AM
Thanks for your reply!
I had set the string to "'\' Code Display" and set them to \n (10),
Enable the "Send End" in the Instr Property node. After the change above setting,
The error message still shows up after sending the command to the instrument.
This error message shows up after VISA writes, But, I have removed the wait component.
10-22-2018 01:20 AM
I had closed the "NI MAX Check panel"
And Check the the Windows command prompt an type "ping 192.168.1.1
The instrument has response.
Then i execute this VI, the Error message is still shows up.
Even I restart the computer, Then Open this VI, execute it directly
(No open any other tool that communication this instrument IP)
The error message is still showing up.
10-22-2018 01:21 AM
I tried to change the timeout parameter to (200, 500, 1000, 2000), The Error message is still shows up.
10-22-2018 02:41 AM
The error doesn't seem to be related with any timeout or end characters.
Have you closed MAX\Test panel? You probably can't connect two clients.
That TCIP\IP connection probably needs a (the correct) port. It's now using the default port. IIRC, you can specify it in the resource string or in the function.
@WIILE wrote:
I had set the string to "'\' Code Display" and set them to \n (10),
Enable the "Send End" in the Instr Property node. After the change above setting,
The error message still shows up after sending the command to the instrument.This error message shows up after VISA writes, But, I have removed the wait component.
If you set the send end termination character to true, you shouldn't have to put it in the constant. Both do the same, so it's eiter\or not both. You probably also want to set the incoming end character.
Also, that error case is now completely redundant. Both send and receive will skip all their functionality if there is an error in, so the case doesn't add anything. Doesn't hurt much either, but "less is more"...
10-22-2018 04:12 AM
wiebe@CARYA
I had closed MAX\Test panel, Then execute this VIEven I restart the computer,
Then Open this VI, execute it directly, The Error message is still shows up.
(Before this operation, Not open any other tool that communication this instrument IP)
How can I use the other port except the default port?
I create this source in the NI MAX and tested successfully,
In the LabVIEW, The VISA source name component has auto found this source,
I use the same source in the LabVIEW...
So this source should be correct and workable?
Am I missing something?
And.... What is the "IIRC"?
Thanks
已寫:
The error doesn't seem to be related with any timeout or end characters.
Have you closed MAX\Test panel? You probably can't connect two clients.
That TCIP\IP connection probably needs a (the correct) port. It's now using the default port. IIRC, you can specify it in the resource string or in the function.
@WIILE wrote:
I had set the string to "'\' Code Display" and set them to \n (10),
Enable the "Send End" in the Instr Property node. After the change above setting,
The error message still shows up after sending the command to the instrument.This error message shows up after VISA writes, But, I have removed the wait component.
If you set the send end termination character to true, you shouldn't have to put it in the constant. Both do the same, so it's eiter\or not both. You probably also want to set the incoming end character.
Also, that error case is now completely redundant. Both send and receive will skip all their functionality if there is an error in, so the case doesn't add anything. Doesn't hurt much either, but "less is more"...