From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with NI-DAQ Example C Code

This has been copy and pasted. I think I made my original post in the wrong section! http://forums.ni.com/t5/LabVIEW/Help-with-NI-DAQ-Example-Code/td-p/2524308

 

Hi. I've just started working with the NI ISB-6211. This is the first ACD i've ever used, so i'm farily new to this. I have quite a bit of knowledge in programming. After searching through the installation files I found some example C Code that runs in the command prompt. I've modified one quite a bit to get it to do what I want. My question is...

 

Now, i'm having some issues. I'm trying to get it to print a voltage reading into the command prompt. I've hooked it all up and i've used labview to make sure everything is working as it should (Which it does!). When I compile the C program and run it, instead of returning a voltage it just aquires points, and I really have no idea what these "points" are.

 

Here is the main part of the example code:

 

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
			DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,1.0,10.0,DAQmx_Val_Volts,NULL));
			DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000));

			/*********************************************/
			// DAQmx Start Code
			/*********************************************/
			DAQmxErrChk (DAQmxStartTask(taskHandle));

			/*********************************************/
			// DAQmx Read Code
			/*********************************************/

			DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,1000,&read,NULL));

			printf("Acquired %d points\n",read);


Error:

 And then it just moves down to the exit clause. Is there any documentation anywhere which tells me which DAQ command I need to use to print a continuously updating voltage read out? (Just as a decimal, like 5.21V for example).

 

Thank you all

John

 

0 Kudos
Message 1 of 2
(2,744 Views)

Duplicate Post:

 

Please only post questions once, this will ensure you get the best answer to you questions.

 

Matt Surridge

National Instruments
0 Kudos
Message 2 of 2
(2,718 Views)