Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB device works in VISA test panel but not in labview

Solved!
Go to solution

I'm currently trying to build a VI that can synchronize a shutter (for UV-light) with a fludics system. The shutter is a Ludl 4 channel shutter driver (with product # 995068) and I've successfully connected it to my computer thanks to this tutorial: http://zone.ni.com/devzone/cda/tut/p/id/4478 (i.e. through the USB-interface and the drivers created using the Driver Development Wizard)

 

The device works when I'm using VISA test panel (see step 2.3 in the tutorial and the screenshot below). I've created a VI similar to the one in step 3.1 in the tutorial (see screenshot) and although I'm sending the exact same commands the device does not respond to them. I get no error messages and I even get a ":A" as output which is a positive reply indicating no errors ("N" would be the negative reply).

 

I have attached the user manual for the complete MAC 5000 (the shutter I have is a component of this system) which includes the commands I use and a lot of information on how one should communicate with the device.

 

What I'm looking for is to get the device to work in the VI as it does in the VISA test panel. Can anyone help me determine what the VISA test panel does that my VI doesn't?

 

Tutorial: http://zone.ni.com/devzone/cda/tut/p/id/4478

Screenshot: http://i.imgur.com/DrDmz.jpg 

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

You have wired the return count to the bytes to read so you only read 11 characters.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 8
(7,301 Views)

Thanks for your reply!

 

I'm not sure what that number should be but I used 256 that was used in the tutorial (which might not fit for my application?). It didn't change anything. Could this be the problem? Is there any way to see what the VISA test panel use as "byte count" as it obviously works there? I'd like to point out that I am new at working in the labview environment so please don't assume that I know too much.

 

New theory:

I think I might have isolated the problem. If I use my VI to send commands to the shutter, e.g. "open s", and then use the VISA test panel to send "\r" (called the carriage return in the manual) it works! (See screenshot below.) This indicates that my VI can send commands to the shutter but only the VISA test panel can make the shutter execute them.

 

This probably means that the VISA test panel can send the "\r" correctly while my VI somehow fails. Does this make sense and does anybody know how I could fix this?

 

Screenshot: http://i.imgur.com/Oehvm.jpg

0 Kudos
Message 3 of 8
(7,286 Views)
Solution
Accepted by MattiasSolu

Solved, I write the solution down here so that any other beginners that might have the same kind of problem can find it.

 

I searched for "carriage return" and found this https://www.ni.com/en/support/documentation/supplemental/21/labview-termination-characters.html 

 

Through that I learned that there is such a thing as a "carriage return constant" in labview and added an extra write operation writing this to the device after my command and now it works!

 

I've attached a screenshot of the solution.

Message 4 of 8
(7,281 Views)

Nice solution but, there are better means to do this.  VISA actually lets you set some useful properties for a session with a property node.  See the png below.

untitled.PNG

 

Once you set these VISA properties any VI that uses that VISA session will use those settings.  It'll save you a bit in the long run since you can always PROBE the VISA wire to see all of the session's properties and you don't need to remember to send CR after every write.

 

On the side: While these are not the default settings for VISA (except term char = \r) these are the settings the test panel defaults toSmiley Wink


"Should be" isn't "Is" -Jay
Message 5 of 8
(7,264 Views)

Thanks for the explanation. Will implement this when I have time.

0 Kudos
Message 6 of 8
(7,246 Views)

I have had the same exact struggle over the past few days with my Serial device. The VISA Write and Read.VI example works fine if you run it and input your command strings in the Front Panel, but when I use it as a SubVI in my app, the Serial write does not work. My Serial device requires a Carriage Return (\r).

 

Using NISpy, I found that when the example VI is used from the Front Panel, with an \r at the end of my command (Tray=60\r), the command is sent to COM1 as "Tray=60." but when the VI is used as a Sub VI, the command sent to COM1 is "Tray=60\r" and the function does not work.

 

I tried Mattias's solution by changing my write string to just "Tray=60" and coding in an additional Serial Write of the Labview Carriage Return string constant. This works great!!

 

I also tried this solution provided by Jeff, but it does not work for me. So I will stick with Matttias's solution.

 

Also in regards to Jeff's solution, the hexadecimal 0xA is for a line feed (\n), not a carriage return. The code for a carriage return (\r) should be 0xD. Also, the default setting for VISA is a line feed (\n) not a carriage return (\r).

0 Kudos
Message 7 of 8
(7,209 Views)

Hi Jeff

 

sorry to see a very small mistake x0A is a Linefeed

                                                 x0D is a carriage return

greetings from the Netherlands
0 Kudos
Message 8 of 8
(7,199 Views)