LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB device work fine in VISA test panel but VISA read VI in LabVIEW it does not work

Hello, I am trying to connect my Gauge Digital Gratten (or Atten) GA1202CAL to my PC through the usb, but I can not read the oscilloscope response. The oscilloscope (USBTMC class) works well with its original software, but the software is too simple and does not take full advantage of the oscilloscope's capabilities. Therefore, I am doing a VI to control it, but the "VISA read VI" always returns the error: (Hex 0xBFFF0015) The waiting time expired before the operation was completed. The "VISA write VI" works excellently, I can write all the commands and the oscilloscope executes them without problems.
When I use the NI MAX "VISA test panel" it is possible to establish communication without problems, I can write all the commands and read the answer correctly, but it does not happen in LabVIEW.
I have no idea what the problem may be, help is needed.
thanks

0 Kudos
Message 1 of 9
(748 Views)

Can you post your code? How many bytes are you attempting to read? How are you determining that? 

0 Kudos
Message 2 of 9
(746 Views)

Sorry for the inconvenience, but now the program runs without problems. I'm certainly confused, I've been trying to make it work for a whole week and now, without changing anything, it worked for the first time.

0 Kudos
Message 3 of 9
(741 Views)

Certainly I spoke very fast, sometimes communication is established and sometimes not. The code that I am using at the moment is very basic because I am beginning to do the program. Always is the same timeout error in the "VISA".

0 Kudos
Message 4 of 9
(736 Views)

Few things - You are opening and closing the reference to the port every time you write. Dont do that - Open it once at the start of the program, and close it when you are done. (Move the open and close outside your loop) Second, you are attempting to read 1024 bytes with every time you write - if you dont get 1024 bytes, you will get the timeout error you are seeing. Your instrument may or may not return that many bytes with every message - most likely it doesnt. So, use some other method to determine how many bytes to read. Check the manual to see if your instrument ends each message with a carriage return or some other character you can look for on a read. Finally, get rid of the false constant wired to the while loop. How are you going to stop that loop? Aborting the program is like pressing CTRL-ALT-DELETE on your program. Not the correct way to stop it. Use a stop button. 

0 Kudos
Message 5 of 9
(723 Views)

Can you monitor the commands being sent to the Instrument?  It may be communicating using a proprietary command set and Not the standard VISA.  First, try sending:

ID?\n

and check the results rather than "*IDN?\n".

 The instrument had a section on self-test, you could also try the command/query:

*TST\n
or
*TST?\n
Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 6 of 9
(716 Views)

Thanks by your suggestions, but previously I used an usb sniffer to identify the commands that use the oscilloscope because the fabricant don't provide them. Then I know which are the right commands.

0 Kudos
Message 7 of 9
(709 Views)

If you dont know the protocol, you can use the 'bytes at port' property node to determine how many bytes to read. Wire the VISA reference into a property node, and select 'Serial Settings'>Number of Bytes at Port. Wire the output of this to a case structure input - in the 0 case, do nothing, as there is nothing at the port. In the non 0 case, read that number of bytes from the port. You may want to put this in a nested for loop or something - attempt to read from the port say 5 times, with a wait between each iteration.  

0 Kudos
Message 8 of 9
(705 Views)

Thanks by your suggestions. I know that to stop the loop I must use a stop button, and I must move the VISA open and close VI's out of the loop, these are minor details that I will correct soon. And yes, it is necessary send a carriage return with the commands. The problem is with the byte quantity to read, I put 1024 because of that is the quantity used by VISA test panel. But your are right when the command used by me don't imply an answer by the oscilloscope, is when appear the timeout error. Now, when I try to use a "Property node" to find how many bytes are at port I receive the error: (Hex 0xBFFF001D) The specified attribute is not defined or supported by the referenced resource. Sorry by the delay but I don't have a stable internet connection.

0 Kudos
Message 9 of 9
(694 Views)