DAQmxGetTaskNumChans
Hello
the command in the object comes from a previous version. Now, I tried the same command in 2015 of the CVI, but I have not found it.
Anyone know where I can find it or if there is a list where I can see the update command in an overview. I started with CVI 2015 but in the examples are often commands from older versions and it is difficult to get all the.
Best regards
Since it is an attribute of the task, you can find the correct command to dig into the list of the attributes available in DAQmxGetTaskAttribute. Specifically, what you need is:
DAQmxGetTaskAttribute (taskHandle, DAQmx_Task_NumChans, & numChannels);
Tags: NI Software
Similar Questions
-
Undefined function DAQmxSetAIADCTimingMode
I have a creative process, installation, read and stop of typical task in VB6 code. The acquisition part is shown below. This code fails to compile when I include the call of synchronization (in bold). Sub or Function not found. If I remove the line in bold code runs correctly and acquires data. However, the default mode is HighResolution and I want HighSpeed.
Note that all the functions and Mode Timing constants appear in NIDAQmx.h, and I can actually get this device work in high resolution or high speed mode using python. However I prefer not having to rewrite the entire VB6 application following a single function call if I can avoid it.
So why this function is not? BTW - I use DAQmx 14.2 on Windows XP 32-bit
' create task
DAQmxErrChk DAQmxCreateTask("", taskHandle)
'Add an input thermocouple analog channel to the task.
DAQmxErrChk DAQmxCreateAIThrmcplChan(taskHandle, "cDAQ-9214/ai:0", "", minTemp, maxTemp, DAQmx_Val_TemperatureUnits1_DegC, _)
DAQmx_Val_ThermocoupleType1_J_Type_TC, DAQmx_Val_CJCSource1_BuiltIn, 25, "")' set timing
DAQmxErrChk DAQmxSetAIADCTimingMode (taskHandle, Ksystem.txtAIDev.Text, DAQmx_Val_HighSpeed)"Configure the task for the acquisition of the finished sample and read in the data."
DAQmxErrChk DAQmxCfgSampClkTiming (taskHandle, "OnboardClock", frequency, DAQmx_Val_Rising, DAQmx_Val_AcquisitionType_FiniteSamps, numSampsPerChannel)"Set up needed memory space
DAQmxErrChk DAQmxGetTaskNumChans (taskHandle, numChannels)
arraySizeInSamps = numSampsPerChannel * numChannels
ReDim data (arraySizeInSamps)"Start the task and to read the data.
DAQmxErrChk DAQmxStartTask (taskHandle)
DAQmxErrChk DAQmxReadAnalogF64 (taskHandle, numSampsPerChannel, timeout, fillMode, data (0), arraySizeInSamps, sampsPerChanRead, ByVal 0 &)"Call the StopTask module to shut down the DAQmx task.
DAQmxErrChk DAQmxStopTask (taskHandle)
DAQmxErrChk DAQmxClearTask (taskHandle)I managed to solve this problem and put the solution here in case its value to anyone.
I ended up declaring the function and the call of the NIDAQmx (nicaui.dll) dll directly as follows. Worked a treat with a synchronization mode.
Statement at the top of the form code
' original function header and enumerations can be found in NIDAQmx.h
' int32 __CFUNC DAQmxSetAIADCTimingMode (TaskHandle taskHandle, const char [channel], data int32);
'
Private Declare Function DAQmxSetAIADCTimingMode Lib "" nicaiu. "» DLL"(ByVal taskHandle As Long, ByVal channel As String, ByVal Val As Long) As Long
Const DAQmx_Val_HighSpeed As Long = 14712
Const DAQmx_Val_HighResolution As Long = 10195Function call
"See the function DAQmxSetAIADCTimingMode in the top declaration
DAQmxErrChk DAQmxSetAIADCTimingMode (taskHandle, myChannel, DAQmx_Val_HighSpeed) -
How to run the DAQmxGetTaskChannels command
I'm reading the attributes of task of MAX by using various DAQmx with VB6 controls. I found that a simple task of load (DAQmxLoadTask) generates a valid taskhandle of a known in MAX taskname that can be used to get the measurement data using the analog in the command "Read" (DAQmxReadAnalogF64). The results seem to be already scaling according to my setup in MAX. What I want to do is read the names of the configuration tasks in MAX, select a VB and then read the names of channel and the ways of treatment of MAX and measurement data. I tried the following commands without error but still see a result null in the output string variable.
DAQmxGetTaskName
DAQmxGetTaskChannels
DAQmxGetAICustomScaleName
Curiously, the command, DAQmxGetTaskNumChans, book with success the number of channels in the setup of MAX. With this information, I can get the measurement data, but I don't have the engineering units or the names of custom channel for my header output file to include with my measured data.
I was wondering if the problem is related to incompatibility with newer versions of daqmx? Or maybe another reason?
I use Windows XP, with service pack 6, a NOR-DAQmx 9.2.2 VB6 and NI DAQPAd-6015.
Hi hutchins2,
Thanks for posting, click on the link below that seems to be the reason for our problem:
Textual DAQmx Device Information functions will return a NULL result
Eric NOR
-
How to exit properly ChangeDetection thread?
I call the function ChangeDetection of the NI USB-6525 with C in a C++ program code:
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateDIChan (taskHandle, "Dev1/port1/$line0", "", DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxCfgChangeDetectionTiming(taskHandle,"Dev1/port1/line0","Dev1/port1/line0",DAQmx_Val_FiniteSamps,1));
DAQmxErrChk (DAQmxRegisterSignalEvent(taskHandle,DAQmx_Val_ChangeDetectionEvent,0,ChangeDetectionCallback,));
DAQmxErrChk (DAQmxGetTaskNumChans (taskHandle, & numLines));DAQmxErrChk (DAQmxStartTask (taskHandle));
As far as I understand, this creates a separate thread that defines the USB box - 6525 ChangeDetection mode. When the unit detects a signal change, the C++ program calls a function (called ChangeDetectionCallback() in this case), which runs in its own thread (or perhaps the same thread, but in any case not the thread used to call the above code). It is explained here and is due to the argument of '0' in DAQmxRegisterSignalEvent().
What I want to know is: while this thread is running (either one created by one of the above functions or whoever runs ChangeDetectionCallback() in), it is ok to quit the program? It could be any problem resulting from resources unfreed, for example? Are there measures should I take to make sure that everything completes successfully, as making sure always to call DAQmxStopTask() and DAQmxClearTask() before you quit the program?
Hello
If you click Exit, you must release all resources and the sons who have served in your program.
You mentioned the right features, if you work with DAQmx, you must stop and cancel the task. If you work with threads (Thread Safe queue for example), it must be released, too. If you opened the file for playback of /writing, you must close them to provide the means and the free memory again.
brinmr wrote:
I call the function ChangeDetection of the NI USB-6525 with C in a C++ program code:
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateDIChan (taskHandle, "Dev1/port1/$line0", "", DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxCfgChangeDetectionTiming(taskHandle,"Dev1/port1/line0","Dev1/port1/line0",DAQmx_Val_FiniteSamps,1));
DAQmxErrChk (DAQmxRegisterSignalEvent(taskHandle,DAQmx_Val_ChangeDetectionEvent,0,ChangeDetectionCallback,));
DAQmxErrChk (DAQmxGetTaskNumChans (taskHandle, & numLines));DAQmxErrChk (DAQmxStartTask (taskHandle));
As far as I understand, this creates a separate thread that defines the USB box - 6525 ChangeDetection mode. When the unit detects a signal change, the C++ program calls a function (called ChangeDetectionCallback() in this case), which runs in its own thread (or perhaps the same thread, but in any case not the thread used to call the above code). It is explained here and is due to the argument of '0' in DAQmxRegisterSignalEvent().
What I want to know is: while this thread is running (either one created by one of the above functions or whoever runs ChangeDetectionCallback() in), it is ok to quit the program? It could be any problem resulting from resources unfreed, for example? Are there measures should I take to make sure that everything completes successfully, as making sure always to call DAQmxStopTask() and DAQmxClearTask() before you quit the program?
Best regards, Fabian
Maybe you are looking for
-
When I open Firefox 70-80 + windows open. How can I fix?
When I click on Firefox to start a new session, 70-80 + windows open.
-
Memory for the Satellite 2400-103
My laptop satellite has 256 RAM, can I upgrade to 1 GB of Ram, or only 512?103-model Satellite S2400!A Finn
-
Webcam in car open failure. Please resart camera or computer
Hallo ich hab since 2 weeks problem mit meiner out nur noch sharp message open drive Webcam Webcam fail. Please resart camera or computer Eure thankyou hilfe das die geht wieder Cam weil ich sie as skyp thankyou HAB schon so viel bei google read leid
-
How to create a Microsoft executable in xcode?
I have created many C++ programs using xcode and drove these Terminal Server programs using the executable file. I would like to generate an executable file that is running on a PC, which is a compatible file (*.exe) Microsoft. I can do that with Xc
-
Value problem of features for the INF with the winpk filter installation.
Hello I use an inf to my driver installation using properties of LAN, but I am facing the following problems during the installation of my driver with the installation of the winpk filter: All these changes are made with windows 2008 R2 64-bit Server