anderssd
2008-07-11 16:40:14 UTC
I have an application written in ansi C that will create an NI task that will run a continueous collection of several AI lines at a set collection rate (see CollectionRate below). This is a simplified version of the setup of the ai task:
ni_rc = DAQmxCreateTask ( "", // name assigned to the task &ai_task); // reference to the task created in this function
for (i = 0; i < ai_channels; i++) { /* Create an NI AI voltage channel. */ if (ai_ptrs[i].chan_num >= 0) { char chan_name[MAX_STRLEN]; // NI channel name, e.g. "Dev1/ai2"
// long chan_num = ai_ptrs[i].chan_num;
sprintf (chan_name, INPUT_CHANNEL_FORMAT, deviceName, chan_num); ni_rc = DAQmxCreateAIVoltageChan ( ai_task, // task to which to add the channel chan_name, // names of the physical channels to use "", // name(s) to assign to the created virtual channel(s) terminal_config, // differential vs. single-ended (double) devsupp_ai_channels[chan_num].volts_min, // minimum voltage expected (double) devsupp_ai_channels[chan_num].volts_max, (long) DAQmx_Val_Volts, // units in which to generate voltage (unscaled) ""); // name of a custom scale } } ni_rc = DAQmxCfgSampClkTiming (
ni_rc = DAQmxCreateTask ( "", // name assigned to the task &ai_task); // reference to the task created in this function
for (i = 0; i < ai_channels; i++) { /* Create an NI AI voltage channel. */ if (ai_ptrs[i].chan_num >= 0) { char chan_name[MAX_STRLEN]; // NI channel name, e.g. "Dev1/ai2"
// long chan_num = ai_ptrs[i].chan_num;
sprintf (chan_name, INPUT_CHANNEL_FORMAT, deviceName, chan_num); ni_rc = DAQmxCreateAIVoltageChan ( ai_task, // task to which to add the channel chan_name, // names of the physical channels to use "", // name(s) to assign to the created virtual channel(s) terminal_config, // differential vs. single-ended (double) devsupp_ai_channels[chan_num].volts_min, // minimum voltage expected (double) devsupp_ai_channels[chan_num].volts_max, (long) DAQmx_Val_Volts, // units in which to generate voltage (unscaled) ""); // name of a custom scale } } ni_rc = DAQmxCfgSampClkTiming (