LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to migrate two VIs from Labview 6 and 7 to Labview 2009

I'm trying to migrate two VIs from our old machines onto a brand new computer. I'm having problems with both VIs. The first is a DAQmx related VI migrated from LabVIEW 6, and the second is a VISA-related VI migrated from LabVIEW 7.

 

The first one is probably the easier solution. I'm trying to simply read in pressures on four sensors and a temperature on one sensor, and graph all of them. When I'm stepping through execution or running highlighted, it works perfectly, but when I'm just running normally (even with as high as a fifteen second 'wait' time), the while loop in my program only operates correctly the first time through. How can I fix this?

 

The second problem may be a little more hardware-driven. I'm trying to control a vacuum pump over an RS/232 connection, and I'm getting timeouts in the driver VIs that were downloaded from the company that made the pump. The exact error message is

"Error -1073807339 occured at VISA Read in AGCxxx Transaction.vi->AGCxxx Query GAuge.vi->AGCxxx Getting Started I sub.vi -> AGCPUMP1.vi

 

Possible reason(s):

 

VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.

 

I've tried increasing the timeout value, but it doesn't seem to affect anything.

 

Any suggestions?

 

(VIs are attached. Transducer Graphso.vi is the first issue, AGCPUMP1.vi is the second issue.)

Download All
0 Kudos
Message 1 of 10
(2,968 Views)

Could you explain what the DAQ hardware and how many serial instruments you actually have. The DAQ code is confusing because you use global channels with multiple DAQmx Reads. If each one uses a different DAQ board, that might work. If each one is using the same DAQ board, then that is quite wrong.

 

The same is true of the VISA program. You have multiple VISA Resources running in parallel and that would only make sense if you have a separate instrument/serial port for each. If not, again very wrong programming.

0 Kudos
Message 2 of 10
(2,955 Views)

I have a PXI-6070E that has thirteen different devices (mostly pressure transducers) wired to the physical channels of a breakout board plugged into the PXI card. So, one card, multiple devices. I'm using the global channels and DAQmx Reads as instructed in this tutorial: http://zone.ni.com/devzone/cda/tut/p/id/4342

 

I only have one instrument for the VISA program, and only one serial port.

 

What would be the correct way to write these programs? I have to admit, I know next-to-nothing about LabView, and have been trying to learn as I go while moving these VIs over.

0 Kudos
Message 3 of 10
(2,941 Views)

You can only have a single DAQmx card for a single resource. In other words, you have to combine all channels and use a single DAQmx Read. You should also get rid of all of those local variables. Instead, use shift registers. The only way to have separate DAQmx Reads (or Writes) would be to start and stop each task before proceeding to the next.

 

You will also need to make sure that you don't have parallel writes and reads going to the serial port. If you write in one place, how can you possibly know that a read is associated with that specific write. You are also constantly writing and reading - even when the controls do not change.

 

I would suggest an event structure to do writes only when a control changes. If there is constant polling to be done, poll the instrument sequentially in a separate loop. Use the error in/error out connections to enforce order.

0 Kudos
Message 4 of 10
(2,934 Views)

Be aware that LabVIEW's threading model changed between versions 6.1 and 7.0 (I think, it could have been 6.0 and 6.1).  It changed to properly use operating system threads.  This can produce major changes in timing.  It is easily possible that things that used to work will no longer due to old race conditions becoming obvious.  Two things you can do to help:

 

 

  1. Do not use globals and locals as data storage.  Use, in order of preference, wires/shift registers, data value references, single-element queues, or functional globals.  The last two are equally good.
  2. Beware of delay functions parallel to other code (e.g. ms wait parallel to a data acquisition task in a loop).  With the new threading model, the wait and acquisition take place at the same time, often resulting in no wait, where before they would execute sequentially.

 

0 Kudos
Message 5 of 10
(2,921 Views)

The DAQ program is now working absolutely beautifully thanks to your help, but I'm still having a hard time figuring out the AGC program. Where are the multiple VISA sessions happening? I only see one VISA Open, which happens inside the 'Initialize' VI.

Also, I tried to read only one bit from the serial port, and it still timed out, so I'm still wondering if there's a hardware problem somewhere.

0 Kudos
Message 6 of 10
(2,834 Views)

You've got 6 hidden VISA Resource controls and they all are set for Com5. Don't know why you could not find them on the block diagram. the initialize function is using an alias called AGC. That's probably another reference to Com5. You've also got two that are using Com6.

0 Kudos
Message 7 of 10
(2,827 Views)

I don't know why I didn't notice them before, but thanks for pointing those out.

 

However, I'm beginning to suspect that the problem is not, in fact, in my VI. I'm trying to communicate with the instrument through a VISA test panel, and I'm getting the timeout error no matter what I do. I've tried using both types of termination character for my commands (both /r and /n), I've tried using both the basic default command in the VISA test panel, as well as the query command that the manufacturers' drivers send. Both time out, even when reading only one bit.

 

Any suggestions?

0 Kudos
Message 8 of 10
(2,799 Views)

The correct way to specify a CR or LF on the test panels is \r or \n, respectively, not /r /n.

 

In LabVIEW use either the CR/LF constants, or make sure that your string constant is in '\' display mode before you enter \r and/or \n.

0 Kudos
Message 9 of 10
(2,785 Views)

Funnily enough, I always type the \ correctly when I'm typing it into the program or the test session, but I seem to typo it when I'm, say, here. I'd edit the previous post if I could, but it looks like I'm locked out of it now.

 

Suffice to say, I did input the string constants correctly.

0 Kudos
Message 10 of 10
(2,773 Views)