Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

mx driver equivalent of DAQ_Start() in traditional driver

What is the function in mx that is equivalent to DAQ_Start() in traditional driver?
 
DAQ_Start (1, 3, 1, Bitvalue1, 1000, 4, 8);
I want to read the sample every 0.8 seconds.
 
 
0 Kudos
Message 1 of 6
(3,691 Views)

addition to  the above question.

I wanna read 1 samples every 8 miliseconds.

I use DAQmxReadBinaryIU16();  this is unscaled/raw data.

How to I scale it back to voltage?

0 Kudos
Message 2 of 6
(3,678 Views)

Hi Ithsin,


Here is a great resource for getting started with NI-DAAQmx.

Transitioning from Traditional NI-DAQ (Legacy) to NI-DAQmx Using ANSI C and NI LabWindows™/CVI

 

Part 3 of this resource has information about the equivalent DAQ_Start() command for NI-DAQmx.  I have included the answer to this question in the post below.  I would strongly recommend that you go through the entire article to get a better understand of how to program in NI-DAQmx

 

In Traditional NI-DAQ, you need to start the task to actually begin the operation. You start the configured task by using the DAQ_Start() function.

 

With NI-DAQmx, you do not need to start the task explicitly. Calling the Read and Write methods automatically starts the task. You can also call start the task explicitly by using the DAQmxStartTask(taskHandle) function:

 

For information about the various types of timing supported by NI-DAQmx, refer to the “Task State Model” section in the NI-DAQmx Core Help.

Refer to the NI-DAQmx C Help “Task State Model” topic for more information about the task state model in the DAQmx ANSI C API.

 

 

 
Jared T.
0 Kudos
Message 3 of 6
(3,653 Views)
As a follow-up to your second question, is there are reason you are reading your data as a binary value and not reading the voltage directly?  What type of signal are you trying to read?
Jared T.
0 Kudos
Message 4 of 6
(3,652 Views)

I want 1000 samples taken at every 8 miliseconds.

My code is like this:

  DAQmxCreateTask ("", &new);
  DAQmxCreateAIVoltageChan (new, "Dev1/ai4", "", DAQmx_Val_RSE , 0, 10, DAQmx_Val_Volts , "");
  DAQmxSetTimingAttribute (new, DAQmx_SampClk_TimebaseDiv, 8);
  DAQmxReadAnalogF64 (new,1000, 8, DAQmx_Val_GroupByChannel,
         data1, 1000, &numRead, 0);

and it doesnt work.Supposedly we have to until 8 seconds before the ReadAnalogF64() writes to the data1 but it writes the same value.

 

0 Kudos
Message 5 of 6
(3,649 Views)

It looks like you are trying to divide down the time base to get your desired sampling rate.  To configure the sampling rate you can do so directly by using the DAQmxCfgSampClkTiming command.  You can then set your sample rate, and use the DAQmxReadAnalogF64 to specify how many samples to get from the hardware buffer with each read.


Are you trying to divide down an external clock?  If so you may find this post helpful.


What kind of hardware you using?

Jared T.
0 Kudos
Message 6 of 6
(3,622 Views)