LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Query works in MAX but from LabVIEW no answer

Hello Everyone!

I found an interesting behavior of VISA what I have never seen before. We have an electrical load emulator which use Arduino nano (With CH340 serial chip).

First I tried the communication in NI MAX VISA test panel without any error. Termination character is \n  (0xA).

When I wanted to communicate from LabVIEW (with same settings like in MAX) I always get timeout.

I read several forum and I tried everything I found  (with termination setting, without termination settings, with byte at port, with manual termination in code display and so on), without success. 

Now I ran out of ideas. I am using LabVIEW and several automotive communications for more then 10 years but till now there was no problem with them.

Do you have any idea what is the problem?

Thanks in advance.

0 Kudos
Message 1 of 8
(1,436 Views)

I would remove the property node to automatically append the termination character and instead append it explicitly to every command you send out.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 8
(1,385 Views)

I have already tried it with two way but unfortunately the result was same 😕

Download All
0 Kudos
Message 3 of 8
(1,371 Views)

In MAX, you are sending asdasd\n and getting a response.  In LabVIEW, you are sending IDN?\n and not getting a response.

 

What code are you running on this Arduino?  Are you sure it is programmed to respond to IDN?\n ?  I've only seen that command present on "instrument" type devices like multi-meters, signal analyzers, etc.

0 Kudos
Message 4 of 8
(1,362 Views)

Well, RavensFans mentions indeed the next point. I was dismissing this as a totally obvious problem that surely can't be at work here. But does your Arduino program really implement the IDN? command? If it doesn't it's no wonder that you get no response from it. Just because commercial measurement devices typically implement the IDN? query, does not mean that all the devices out there implement it too, especially if you created the Arduino program yourself and "forgot" to add that command to its repertoire.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 8
(1,346 Views)

Sorry for late answer, as a new user I had to wait 24h to replay...

So yes, I am aware of not every instruments know the *IDN? command but in this case this is not problem because the arduino code is written the following way:  If there is no case for the request command then arduino send "NAKPRM" string. So I can send asdasd, *IDN? or anything else, I will get "NAKPRM" ( see picture "1" attached).

Today I removed from the arduino code the \n termination request to make it easier to debug but result is same. In the VISA test panel when I send anything without \n termination I get the answer, from LabVIEW not.

After I modified the arduino code to increment a variable in every 300ms and serial print it out and the result interesting.

In the LV code I made a loop to read every 300ms the serial port and in this case I can read the incrementing number (see on "Continous_read" pics).

 

Now I have no more idea, If I send a request and wait for the answer there is no way to make it work, but when I just read continuously then working well.

I think maybe there are some serial driver timing, or cheap Chinese arduino problem but I don't know why is it work from VISA test panel, and why not from LabVIEW.

Download All
0 Kudos
Message 6 of 8
(1,291 Views)

Why are you only reading 1 byte at a time in this case?

 

Why don't you attach your Arduino code?  If there was a but in a program, I'm quite sure it would be in any unseen Arduino code rather than in VISA drivers or a very basic LabVIEW implementation of VISA serial communications.

0 Kudos
Message 7 of 8
(1,260 Views)

I read one byte because I only wanted to check that case when arduino send an incrementing number to the serial port. It was a fast check.

I can not share the arduino code because of company rules unfortunately.

And I thought for the RS232 port driver and of course not for the VISA driver..

By the way I updated the VISA driver to 20.0 but didn't help.

0 Kudos
Message 8 of 8
(1,252 Views)