LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MidLevel AI VI dies ... WHY?

Hi Everyone!

I am using the mid-level analog input VIs to do continuous
data acquisition. The problem I amencountering is that sometimes
the data acquisision fails when call AIClear/AIConfig which leads
to some sort of change in the VIs and from then on I keep getting
error 10027 from AIControl (called from AIStart), no matter what I
do until I completely restart LabVIEW.

This appears to be tied to the use of contiunuous data acquisition
(num-scans = 0). I would appreciate if anyone could tell me

(a) What I can do to prevent this from happening or
(b) What I can do to reset the VI so I can restart
after an error ...

Rudolf
0 Kudos
Message 1 of 5
(2,583 Views)
Rudolf,

I can help you with b)

There is a function in the DAQ>Calibration... Pallette that resets the DAQ Board. You can include this in your code to reset the card/daq session when you have an error (just wire it without the error cluster in the "No Error" case of a case wired to the source of your errors.

Without seeing your code, I cannot exactly tell what the problem is, but I believe that it has to do with a call to AI Config BEFORE you call AI Clear. It also may have to do with the AI Clear being called when an acquisition is still in process. Not sure, but that's where I would look if I were you.

Please let us know how you do.
0 Kudos
Message 2 of 5
(2,583 Views)
: There is a function in the DAQ>Calibration... Pallette that resets the
: DAQ Board. You can include this in your code to reset the card/daq
: session when you have an error (just wire it without the error cluster
: in the "No Error" case of a case wired to the source of your errors.

Cool! That works. Got me a bit screwed up in the beginning because you
can let that VI lie around unconnected (which I did after reading
the help on it) and all it will really do is start collecting ALL
channels 😉 ... but it IS working now.

: Without seeing your code, I cannot exactly tell what the problem is,
: but I believe that it has to do with a call to AI Config BEFORE you
: call AI Clear. It also may have to do with the AI Clear being called
: when an acqui
sition is still in process. Not sure, but that's where I
: would look if I were you.

Yes, I see. The real problem is: I am running continuous data acquisition,
and the problem appears to be that the AI Clear returns before all the
buffer clearing is actually finished. I tried waiting for the occurrence
I have set anyhow but that didn't totally remove the problem either. I'll
continue with what I have but I fear it will be a bit cumbersome because
the RESET approach is likely to reset any concurrently running output
as well ...

Rudolf
0 Kudos
Message 3 of 5
(2,583 Views)
Rudolf;

The best way to go is to run one of the Labview shipping examples that does continuous acquisition, and see if the error remains. If it does, there is something wrong with your hardware, if it doesn't, your VI needs to be changed.
The best one for you is the one named "Continuous Acquisition and Chart (buffered).vi" that can be found at Search Examples->I/O Interfaces->Data Acquisition->Analog Input->Continuous Analog Input.
Regarding your second question, if you needed to abort the VI execution after an error, the best approach is to use the VI named Reset.vi (found at the DAQ pallet->Calibration pallet) to reset the parameters of the board back to teh default states.
Hope this helps.
Filipe
0 Kudos
Message 4 of 5
(2,583 Views)
Filipe wrote:
: Rudolf;

: The best way to go is to run one of the Labview shipping examples that
: does continuous acquisition, and see if the error remains. If it does,
: there is something wrong with your hardware, if it doesn't, your VI
: needs to be changed.

It's not quite that easy. The problem is quite distinctly with the Mid-Level
utility VIs. What seems to happen is that in the continuous acquisition
mode there is no way to tell when AIClear has actually given up its
locks for the given buffer. If I try to run one of the VIs shipped in
the examples it will run for non-buffered but die for buffered the same
way mine does. I admit I have not tried running a compiled VI afterwards
but I am pretty sure that would work. What I presu
me is happening is that
in the case where AIConfig is called after AI Clear but before the background
acquisition has actually finished, some static varible in the mid-level VIs
does not get reset and can thereafter not be reset until the memory allocated
to that variable is freed (i.e. reset the card or restart LabVIEW).

Rudolf
0 Kudos
Message 5 of 5
(2,583 Views)