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.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx read analog inputs

Hello,

I would like to read the value of multiple channels on a NI USB-6229 BNC. I created one task to my programm and 4 AI VoltageChan. Is it correct?

 

DAQmxErrChk(DAQmxCreateTask("DAQMonitoring", &taskOut));

DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "Dev1/ai0", "Tension_0", DAQmx_Val_RSE, 0, 5, DAQmx_Val_Volts, ""));	
DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "Dev1/ai1", "Tension_1", DAQmx_Val_RSE, 0, 5, DAQmx_Val_Volts, ""));	
DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "Dev1/ai2", "Tension_2", DAQmx_Val_RSE, 0, 5, DAQmx_Val_Volts, ""));	
DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "Dev1/ai3", "Tension_3", DAQmx_Val_RSE, 0, 5, DAQmx_Val_Volts, ""));
	

 

Now, if I click on a start button on my GUI, I would like to read the 4 input values and change 4 register meters values (still on my GUI).

But I do not understand how to do on my program. Do I have to create 4 tasks? One task for each analog input?

 

I know that I have to start a task, read analog input (or inputs but I dont't know how to do that) and stop the task.

Could you please help me?

 

tx,

gold5

0 Kudos
Message 1 of 2
(3,849 Views)

Hi gold5,

 

the easiest way is to search for an example. With CVI we ship a lot of examples. Just browse to Help >> Find examples. In the lower left corner you can define your hardware. In your case it is named "USB-6229 (BNC)". When you check the option "limit results to hardware" CVI will only list the examples which work with your hardware.

Second step is to browse through the categories. Select Hardware Input and Output >> DAQmx >> Analog Measurement >> Voltage. You will find several examples for different projects. Of course you can modify each example to fit to your application.

 

If you have further questions feel free to come back to me.

 

Kind Regards,

Vanessa

AE Germany

0 Kudos
Message 2 of 2
(3,831 Views)