Analog Input/Output of the myRIO
Analog input and output interfaces are available on each of the three myRIO connectors. All interfaces have 12-bit resolution, with \(16-\)V overload protection. The maximum aggregate sampling rate is \(500\) kS/s for inputs and \(345\) kS/s for outputs. Other characteristics of these channels differ depending on the connector. Although the basic capabilities are summarized here, see NI2013 and Horowitz2015 for further hardware details.
ADC and DAC on Connectors A and B
Connectors A and B both have four analog input (AI) channels, with nominal input ranges of \(0\) V to \(+5\) V, and absolute accuracies of \(\pm 50\) mV. For each channel, the operating input impedance exceeds 500 k. These channels are said to be “single-ended,” implying that the voltages of all channels are measured relative to a reference voltage (in this case, ground).
Each of these connectors also has two single-ended analog output (AO) channels, with nominal ranges of \(0\) V to \(+5\) V and absolute accuracies of \(\pm 200\) mV. For each channel, the maximum output current is \(3\) mA, with a maximum slew rate of \(0.3\) V/μs.
ADC and DAC on the C connector
In our experiments, we will be using the AIO channels on connector C. On that connector, there are two analog input channels with nominal input ranges of \(-10\) V to \(+10\) V. Voltages outside that range “saturate” the conversion, as shown in . These ADCs have resolutions of \(4.883\) mV, with absolute accuracies of \(\pm200\) mV. The input impedance is such that the maximum operating leakage is \(100\) nA.
In contrast to the single-ended inputs on connectors A and B, the connector C input channels are differential: for each channel, the measurement is the difference between the voltages on two terminals. Benefits of the differential receivers include that they reject noise common to both terminals and generally allow longer cable runs.
There are also two single-ended AO channels on connector C, with nominal ranges of \(-10\) V to \(+10\) V. Again, specified voltages outside that range saturate the conversion, as shown in . The DACs have resolutions of \(4.883\) mV, with absolute accuracies of \(\pm200\) mV. Each channel has a maximum drive current of 2 mA and a maximum slew rate of \(2\) V/\(\mu\)s.
Configuring AIO channels
In lab 6, lab 7, lab 8, we will use ADC and DAC channels to quantify and create analog signals. Each analog channel must be initialized before it can be read or written. Three functions are provided in the T1 library to initialize the analog input channel 0 and the analog output channels 0 and 1 on connector C. The prototypes of these functions are
void Aio_InitCI0(MyRio_Aio *AIC0); // Input 0
void Aio_InitCO0(MyRio_Aio *AOC0); // Output 0
void Aio_InitCO1(MyRio_Aio *AOC1); // Output 1
where AIC0
, AOC0
, and AOC1
, are structures of type MyRio_Aio
. These structures are populated by
the initialization functions, and will be referenced in the analog
channel read and write functions described the following sections.
In lab 6, connector C analog input AIC0
and analog output AOC1
will be used. The code to initialize
these two channels should be
; // Connector C analog input 0
MyRio_Aio AIC0; // Connector C analog output 1
MyRio_Aio AOC1(&AIC0); // Initialize input 0
Aio_InitCI0(&AOC1); // Initialize output 1 Aio_InitCO1
For more information on configuring AIO channels, see section G.2.
Reading analog inputs
An analog input channel can be read to a double
with the
Aio_Read()
function from the myRIO C library’s AIO.h
header. Its prototype is
double Aio_Read(MyRio_Aio *channel);
This function is invoked on a MyRio_Aio
channel initialized as described
in subsection 6.5.3. For the initialized channel AIC0
, the input can be read with
double v_in;
= Aio_Read(&AIC0); // AI voltage reading v_in
The reading is in volts.
Writing to analog outputs
Analog output channels can be written from a double
with the
Aio_Write()
function from the myRIO C library’s AIO.h
header. Its prototype is
void Aio_Write(MyRio_Aio *channel, double value);
This function is invoked on a MyRio_Aio
channel initialized as described
in subsection 6.5.3. For the initialized channel AOC1
, the output can be written with
double v_out = 3; // V
= Aio_Write(&AOC1, v_out); // AO voltage writing v_out
Note that the DAC maintains the voltage at its output terminal until
it is altered by a subsequent execution of Aio_Write()
.
Online Resources for Section 6.5
No online resources.