Overview of the Analog I/O Wildcard Device Driver Functions
-----------------------------------------------------------

The Analog I/O Wildcard driver code makes it easy to initialize the A/D and DAC, 
acquire 16-bit samples from the A/D, and write 12-bit values to the DAC.  The 
following sections describe the functions that initialize the A/D and DAC, read 
from the A/D inputs, and write to the DAC outputs.

Most of the functions accept as input parameters the channel number and the Analog 
I/O Wildcard Number (0 through 7).  Be sure the module number passed to the software 
functions correspond to the hardware jumper settings.


Initializing the Analog I/O Software Drivers
--------------------------------------------
  
Use Init_Analog_IO to initialize the software drivers for the DAC and A/D, set the 
reference voltage of the DAC, and output 0 volts to all DAC channels.  Init_Analog_IO 
must be called before attempting to read a value from the A/D or write a value to the 
DAC.  The constants INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12, specify one of the 
three different reference voltage options for the DAC when passed to Init_Analog_IO.  
The following section provides more information about the DAC reference voltage 
options.


Using the DAC Drivers
---------------------

The Analog I/O Wildcard has eight 12-bit DAC outputs.  Each DAC accepts a number 
between 0 and 4095 that we'll designate as N, and outputs a voltage given by:

	Vout = N * 2*Vref / 4096

There are three different options for Vref:
	1.	The DAC's internally generated 2.048 volts, selected by passing the constant 
      INT_2V_DAC12 to Init_Analog_IO.  This is the default option and provides an 
      output range for each DAC channel of 0 to 4.096 volts.
	2.	The DAC's internally generated 1.024 volts, selected by passing the constant 
      INT_1V_DAC12 to Init_Analog_IO.  This provides an output range for each DAC 
      channel of 0 to 2.048 volts.
	3.	An externally generated voltage applied to the reference pin (pin 4) of the 
      Field Header with jumpers J3 and J6 installed, selected by passing the 
      constant EXT_DAC12 to Init_Analog_IO.  The maximum voltage of the externally 
      generated voltage is 0 to 5 volts.  However, voltages above 2.048 volts will 
      probably result in degraded performance of the DAC.  Also, the maximum 
      specified output voltage range is 4.6 volts.

The constants that are associated with the DAC output channels are DAC12_CH0, 
DAC12_CH1, DAC12_CH2, DAC12_CH3, DAC12_CH4, DAC12_CH5, DAC12_CH6, and DAC12_CH7.  
To output a voltage to the DAC, use the function To_DAC.

Another useful function, named To_All_DACs, simultaneously outputs a single 12-bit 
value to all DAC channels on a specified module. To_All_DACs uses the primitives 
Delay_Update_DAC12 and Update_DAC12 to simultaneously output the specified value 
to all channels.


Using the A/D Drivers
---------------------

The Analog I/O Wildcard features eight 16-bit single-ended input channels or eight 
16-bit differential input channel options.  In differential mode, the negative analog 
input cannot go above the positive analog input and the negative analog input cannot 
go above 1.25 volts.  Each analog input channel has a maximum range of -0.2 volts to 
5.2 volts.  The sixteen different input options are AD16_CH0, AD16_CH1, AD16_CH2, 
AD16_CH3, AD16_CH4, AD16_CH5, AD16_CH6, AD16_CH7, AD16_CH0_CH1, AD16_CH1_CH0, 
AD16_CH2_CH3, AD16_CH3_CH2, AD16_CH4_CH5, AD16_CH5_CH4, AD16_CH6_CH7, or AD16_CH7_CH6.  

To read a single voltage from the A/D, use the function AD16_Sample.  To convert the 
16-bit result returned from AD16_Sample into a voltage, use the following Equation.

	Input Voltage = ( Count * Vref ) / 65536

Where Vref is the reference voltage selected using the voltage reference selection 
jumpers which are described in the "Analog I/O Wildcard User Guide".  With the default 
voltage reference selection jumper configuration (jumpers J4 and J6 installed), Vref 
is 4.096 volts.

The function AD16_Multiple rapidly obtains a specified number of samples from an A/D 
channel and stores the results as sequential 2-byte values in memory starting at the 
specified extended address.  If the specified extended address is in common RAM, the 
fastest sampling frequency is approximately 17 kHz (corresponding to 57.5 microseconds 
per sample).  If the specified extended address is in paged memory, the fastest 
sampling frequency is approximately 12 kHz (corresponding to 82.5 microseconds per 
sample).  The timing parameter specifies the timing of the samples, with 0 representing 
the fastest sampling rate, and 65,535 representing the slowest sampling rate.  
