LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Error about the AIClearAcquisition,please help

Hello
I'm working on Labwindows/CVI 7.1.1 and NI-DAQ 7.4 with NI-PCI6014

I want to make a program that can acquire analog voltage input in seperate channels simultaneously and I
use the function "AIClearAcquisition" in Easy I/O for DAQ Labrary. but when the program is running ,it generates
the error ,here is the information:


NON-FATAL RUN-TIME ERROR
Function AIClearAcquisition:(return value ==-10401 [0xffffd75f]).
unknownDeviceError:The specified device is not a National Instruments product,
the drive does not support the device (for exmaple, the driver was released
before the device was supported). or the device has not been configured using
the Measurement & Automation Explorer.


My C code is:


AIClearAcquisition (task0);
AIStartAcquisition (board, channel0, 2*points0, samprate0, 10, -10, &rate0, &task0);
SetCtrlAttribute (multipnl, multipnl_TIMER_CHAN0, ATTR_ENABLED, 1);

the board number is 1,channel0 is "0"

But when i run a sample "spectrum" in which AIClearAcquisition is used ,it works well with no above error.
I don't why?please help

Thanks a lot.
0 Kudos
Message 1 of 5
(3,324 Views)
What's in task0 when you first call AIClearAcquisition? Usual way of operating of these functions should be

1. Start an acquisition and retrieve process ID
2. End an acquisition in prgress identified by process ID

If you try to stop the acquisition before it has started you are likely to get an error, even though I expected this error to be "No acquisition is in progress" or similar one.

Have you tried to comment the AIClearAcquisition and execute directly the next AIStart? Does it returns an error? If so you may have some problems in configuration of your device and you may need to revise its configuration in MAX.

Another common issue if the "Break on library errors" check box in Options >> Run options menu in the project window: since it is project related, it may have happened that this box is unchecked in Spectrum project (and so a non-fatal error is filtered out) and checked in your project: please revise it. You can uncheck it in your project, even though I do reccommend you let it checked in developing and debugging the application since it gives you full control over the correctness of your code.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(3,313 Views)
Hi,Roberto Bozzolo
Thanks for your reply.
Since I'm new to CVI ,until you mention what is in task0 I found i didn't start a task before the AIClearAcquisition function ,now I delete the AIClearAcquisition function and the program runs with no error popup
but there are new problems :
I want to acquire analog voltage in 2 channels simultaneously
part of my C code is :
:
<<<<<<<<<<<
AIStartAcquisition (board, channel0, 2*points0, samprate0, 10, -10, &rate0, &task0);
SetCtrlAttribute (multipnl, multipnl_TIMER_CHAN0, ATTR_ENABLED, 1);
>>>>>>>>>>>
(the cmd button 0 enables the timer_chan0 and the timer_tick event begins)
the TIMER_CHAN0 callback is:

<<<<<<<<<<<<<<<
AIReadAcquisition (task0, points0, LATEST_MODE, &backlog0, GROUP_BY_CHANNEL, waveform0);
DeleteGraphPlot (panelHandle, multipnl_GRAPH_CHAN0, -1, VAL_DELAYED_DRAW);
PlotY (multipnl, multipnl_GRAPH_CHAN0, waveform0, points0, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
>>>>>>>>>>>>>>>

:
<<<<<<<<<<<
AIStartAcquisition (board, channel1, 2*points1, samprate1, 10, -10, &rate1, &task1);
SetCtrlAttribute (multipnl, multipnl_TIMER_CHAN1, ATTR_ENABLED, 1);
>>>>>>>>>>>
(the cmd button 1 enables the timer_chan1 and the timer_tick event begins)
the TIMER_CHAN1 callback is:

<<<<<<<<<<<<<<<
AIReadAcquisition (task1, points1, LATEST_MODE, &backlog1, GROUP_BY_CHANNEL, waveform1);
DeleteGraphPlot (panelHandle, multipnl_GRAPH_CHAN1, -1, VAL_DELAYED_DRAW);
PlotY (multipnl, multipnl_GRAPH_CHAN1, waveform1, points1, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
>>>>>>>>>>>>>>>

Problems are:

1.When the program runs it returns no error
BUT I FIND : two graph controls display the same waveform which the two graph should display different waveform according to the different channel number
(in my program :channel0 is "0" channel1 is "1" borad is 1)
2.I look up the Standard Libraries Reference Manual and find a Function named "void SetEasyIOMultitaskingMode (int multitaskingMode);" so I insert it to the program and set the multitaskingmode to MULTITASKING_AWARE but when I run the program again it generates error:Missing Prototype, I see the easyio.h ,there is no such a function

If I want to acquire 2 or more channels analog input is there any other way to realize (with the Easy I/O for DAQ library)??


thanks really a lot again!!
0 Kudos
Message 3 of 5
(3,310 Views)
The function you are using is for single-channel acquisition and share the same hardware (the daq board): when you start a new acquisition the previous one is stopped and the new one is the only one running.

Besides it, I see that you re using obsoleted functions, that have been superseded by new ones more powerful. You should movo to the new functions for which you can find several examples in \samples\easyio directory.

Since you are new to CVI, my suggestion is that you spend some time studying these sample programs, that can help you to understand data acquisition process; I'm sure you'll find most of all interesting and useful for your needs: part of the code could be the basis of your application.

Consider also to carefully read the help and guides that were installed with NI-DAQ: there are several documents that can give you a conceptual framework to understand the necessary steps to configure and use data acquisition.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(3,305 Views)
Thanks Roberto
I look over some samples of DAQmx in CVI7.1 samples .the daqmx task can do what i want .
0 Kudos
Message 5 of 5
(3,293 Views)