03-03-2008 12:48 PM
03-03-2008 04:48 PM
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?
03-04-2008
11:53 AM
- last edited on
06-28-2024
08:18 AM
by
Content Cleaner
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.
03-04-2008 11:57 AM
03-04-2008 12:32 PM
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.
03-05-2008 12:34 PM
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?