Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA TCP/IP Problem

Solved!
Go to solution

Hi Everyone,

 

I have a problem. I wrote a program that reads sensor values from a device. The device has ethernet port. So I created VISA TCP/IP resource to communicate in NI MAX.

 

So far, there is no problem. I can get sensor values from device with my LabVIEW program.

 

But when I try the same procedure on another computer, my VISA Read function gives me timeout error. I tried to query in NI MAX, also there gives me the same error.

 

I will share a part of my code. Until VISA Read function, there is no problem. But as I said, when it comes to VISA Read function, it gives me timeout error.

0 Kudos
Message 1 of 9
(5,480 Views)

Hi

maybe your problem with the ethernet may be that the device is on a different subnet.

Anyhow I saw 3 parallel openings to the same device and also 3 parallel write read sessions.

That seems a bit too much at one time.

It is allowed in LabVIEW but when talking to the same instrument in parallel you should have a reason to do that. Otherwise you are making your software more difficult to operate than necessary.

greetings from the Netherlands
0 Kudos
Message 2 of 9
(5,464 Views)

I am sorry, I gave wrong information.

 

When I send the commands from NI MAX, the device responds me. For example when I try to measure temperature, it responses me. There is no problem in NI MAX.

 

But on block diagram, when I write the command with VISA Write, I get timeout error from VISA Read. Actually there is no error until VISA Read function.

 

It seems that the device can not recognize my command when I send the command in block diagram. But why??

 

 

0 Kudos
Message 3 of 9
(5,461 Views)

I would like to see one open visa and inside the while start with only one write read combination, not hree in parallel. You can make it too difficult for the device.

Remember that LabVIEW is running wires that are not connected in parallel. Often what you want but not in communicating during IO.

greetings from the Netherlands
0 Kudos
Message 4 of 9
(5,452 Views)

Sir, I tried what you said. I wrote a simple program. One VISA Open, one VISA write and one VISA Read. I send the temperature command. But the result did not change. I took the same timeout error in VISA Read.

 

I think the problem is not because of this. There is another thing that I miss.

 

In MAX, there is no problem. But in block diagram, I take error. Why???

0 Kudos
Message 5 of 9
(5,448 Views)

Did you add crlf to the string as a proper end of command?

Or maybe just lf is enough.

greetings from the Netherlands
0 Kudos
Message 6 of 9
(5,440 Views)

According to the manual, I should add carriage return. So I add it. For example to measure temperature I send the command *SRTC\r with VISA Write function. But still I took the same error.

 

But in MAX, when I send this command, I get response

0 Kudos
Message 7 of 9
(5,439 Views)
Solution
Accepted by topic author Gilfoyle

In LabVIEW to add a CR you have to add the special character not simply \r.

You can add \r if the display of your string shows 

 

I added a snippet in LV15 to this mail.

You can add that to the block diagram of a new vi to use it and look at it.

You can also look at it in a picture viewer but best to insert it in a block diagram.

greetings from the Netherlands
0 Kudos
Message 8 of 9
(5,406 Views)

Sir, I tried today what you said. With one VISA Open and carriage return constant. I put Write and Read functions in stack sequence in while loop. Finally it works. I can read all values.

 

what I learnt from this problem is the usage of carriage return. 🙂

 

Thanks for everything

0 Kudos
Message 9 of 9
(5,378 Views)