Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Error while starting two temperature analog task on two différent boards

Hello

I am developping a acquisition software for two NI PCI-6229 (only simulated into Max for the moment) under Visual Studio 2005.

I have configured two analog acquisition tasks on the 2 devices separatly (different handle...etc) with several thermocouple channels.
The initialisation and the launching of the task seem to work fine. But when i want to read my values, it works on the first device but not on the second one. It says me that my task has not been started.

"Measurements: No data is available to read, because no acquisition has been started.
Start the acquisition before attempting to read data, either explicitly or by enabling auto start and stop.
Task Name: _unnamedTask<4>
Status Code: -200286"    char [2048]"

The funny thing of the problem, is that everything goes right when i add a classical analogical channel in my tasks. I can't get my values simulated by Max.

Is there anything that can explain such a strange behaviour?

Thank you

DanY

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Code extracted from my application:

//Configuration
DAQmxErrChk(DAQmxCreateTask("",&thAcqAna))
if(Ana)
    DAQmxErrChk(DAQmxCreateAIVoltageChan (thAcqAna, strNomVoie, "",iTabConfig[VoieTemp.m_nConfig],
                            VoieTemp.m_flMin,VoieTemp.m_flMax,DAQmx_Val_Volts,NULL))
if(Temp)
    DAQmxCreateAIThrmcplChan (thAcqAna, strNomVoie, "",VoieTemp.m_flMin,VoieTemp.m_flMax,
                                        DAQmx_Val_DegC,m_nTypeThermo,DAQmx_Val_BuiltIn,0.0,"")

DAQmxErrChk(DAQmxCfgSampClkTiming(thAcqAna,"",RATE_ACQ_NI,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1));

//Starting the task
DAQmxErrChk(DAQmxStartTask(thAcqAna));

//Reading the values
DAQmxErrChk(DAQmxSetReadAttribute (thAcqAna, DAQmx_Read_RelativeTo,
                       DAQmx_Val_MostRecentSamp))
DAQmxErrChk(DAQmxReadAnalogF64(thAcqAna,1,1.0,DAQmx_Val_GroupByChannel,&(*m_pfMesuresAna.begin()),                 <- get the error here
                        m_pfMesuresAna.size(),&nNbMesLu,NULL))



0 Kudos
Message 1 of 4
(3,108 Views)
Anyone is inspired by my problem?!

I made more tests on it and my first analysis didn't seems to be right.

In fact, no acquisition on any device can be read when i put 'only' some thermocouple channels.

The DAQmxStartTask function doesn't return any error, it's only when i want to read my values thats the DAQmxGetExtendedErrorInfo says me that i haven't start my task.
Moreover, when i detect the error on the reading, i want to delete the task (DAQmxStopTask + DAQmxClearTask + handle=0) but the application get stuck into the DAQmxStopTask, all the threads working otherwise.

To sum up, i can have tasks with only pure analogical channels, analogical + thermocouple channels but not with only thermocouple channels.

Is anyone have already encontered that problem or is it my task configuration that is wrong?
0 Kudos
Message 2 of 4
(3,087 Views)
Hi DanY,

What happens if you put a DAQmxErrChk() around DAQmxCreateAIThrmcplChan()?

Are you using the same code for both devices?

Brad
---
Brad Keryan
NI R&D
0 Kudos
Message 3 of 4
(3,076 Views)
Hello Brad, thanks for helping me.

The problem doesn't seem to come from the fact that i got 2 cards... I simplify my configuration to investigate it more precisely.

I only put one Thermocouple channel on the first device...
I configure it as said before, everything goes right.
I start the task -> no error

I modify the reading function to get more informations:

        DAQmxErrChk(DAQmxGetReadAttribute(thAcqAna,DAQmx_Read_AvailSampPerChan,&nNbMesLu));
        if(nNbMesLu > 0)
        {
            DAQmxErrChk(DAQmxSetReadAttribute (thAcqAna, DAQmx_Read_RelativeTo,
                           DAQmx_Val_MostRecentSamp))
            DAQmxErrChk(DAQmxReadAnalogF64(thAcqAna,1,1.0,DAQmx_Val_GroupByChannel,&(*m_pfMesuresAna.begin()),
                            m_pfMesuresAna.size(),&nNbMesLu,NULL));
        }
        else
        {
            DAQmxErrChk(DAQmxStartTask(thAcqAna));
        }

I never get an available sample so i try to start the task (as the error says me before that it wasn't started) and I get this:

>"Measurements: Specified operation cannot be performed while the task is running.
>Task Name: _unnamedTask<0>
>Status Code: -200479"    char [2048]

There is a incoherence in the error messages -> When I want to read the samples it says the task is not running
                                                                            -> When i want to start the task it says the task is already running
Smiley Surprised

To test a working situation, I add a classical analog channel in first position (1 analog + 1 thermocouple)
This code doesn't work anymore, i got somes "available samples per channel" at the first cycle but not at the next ones.
That is perhaps due to the fact I only read the most recent ones, when i remove the test on the number of available sample, i get some values at each cycle...

But that doesn't explain me why i haven't any samples when i got only one Thermocouple channel.

Thanks  for help
DanY




Message Edité par danydan27 le 02-04-2008 03:30 AM

Message Edité par danydan27 le 02-04-2008 03:31 AM
0 Kudos
Message 4 of 4
(3,055 Views)