Link here

Analog I/O Wildcard User Guide
Precision voltage measurement using eight 16-bit ADC (analog to digital converter) inputs
and voltage generation from eight 12-bit DAC (digital to analog converter) outputs.


The Analog I/O Wildcard™ is a tiny 2" by 2.5" I/O module for precision 16-bit analog voltage measurement and 12-bit voltage generation. It connects directly to any of Mosaic's embedded controllers to provide high resolution data acquisition and voltage output for instrumentation and control.

This page provides its A/D and D/A specifications, tells how to configure the hardware, and presents an overview of the A/D and DAC driver software. A glossary of the software functions and complete hardware schematics are also included.

 

Analog I/O hardware specifications

The Analog I/O Wildcard comprises a Wildcard bus header, field header, digital logic circuitry, an octal 12-bit digital to analog converter (DAC), an octal 16-bit analog to digital converter (A/D), and a 4.096 volt reference – all the functions needed for data acquisition and high resolution voltage generation in scientific instruments.

The 4.096 reference voltage varies less than 100 microvolts per degree Celsius change in temperature. Jumpers enable module address selection and reference voltage selection among 5V, 4.096V, the DAC reference voltages (1.024 or 2.048 V), or an external reference voltage. The Wildcard bus header interfaces to the host processor (Mosaic embedded controller), and the field header brings out the analog I/O signals for the reference, DAC, and A/D.

Specifications are summarized in the following table.

Analog I/O Wildcard Specifications
Analog Inputs
Input Channels: 8 unipolar single-ended, or 4 unipolar differential
Resolution: 16-bits ( 0 – 65,535 counts)
Input Filtering: Land patterns are provided for optional input RC filters or protection
Input Voltage Range: +IN: -0.2 V to 5.2 V
-IN: -0.2 V to 1.25 V
Full Scale Differential or Unipolar Input Voltage: Jumper selectable full scale reference: 1.024 V, 2.048 V, 4.096 V, 5.0 V, or external reference.
Excitation: Jumper selectable output excitation reference is provided of: 1.024 V, 2.048 V, 4.096 V, or 5.0 V.
NonLinearity: Integral: ± 8 LSB max, ± 3 LSB typ; Differential: ± 1 LSB typ
Noise and Accuracy: 20 μV rms effective input noise; 14.4 bits effective resolution
Sample Rate: Up to 17k samples per second. Conversion time is 14.5 μsec, of which 2.25 μsec is the acquisition time.
Input Impedance: ± 1 μA input leakage current
25 pF converter input capacitance charges through the source resistance during an acquisition time of 2.25 μsec.
Analog Outputs
Output Channels: 8 single-ended
Resolution: 12-bits ( 0 – 4095 counts)
Output Filtering: Land patterns are provided for optional output RC filters
Full Scale Voltage: Jumper selectable: 2.048 V, 4.096 V, or 2x external reference; 4.6 V max.
Settling Time: 1 μsec typically, slew rate is typically 10 V/μsec
Load Impedance: Capable of driving 2 KΩ minimum resistance, 100 pF maximum capacitance, see data sheet for load regulation.
NonLinearity: Integral: ± 2 LSB typ. Differential: ± 0.5 LSB typ.
Offset and Gain: ± 30 mV max. zero offset error; ± 0.6 %FS max gain error.
Update Rate: Up to 15k updates per second
Physical Specifications
Current: 70 mA from 5 V and 10-20 mA from 6-26 V (V+Raw)
Weight: 18 gram
Size: 2" x 2.5" x 0.365" (50.8 mm x 63.5 mm x 9.3 mm)
Power requirements
This Wildcard requires 6 Volts or greater to be present on the V+Raw power rail. The V+Raw rail should not be greater than 26 V. If you are using the Docking Panel or Power Dock, the V+Raw rail is connected for you.

If you are not using a Docking Panel or Power Dock, you will need to connect V+Raw yourself. For the QCard: see QCard Appendix B. For the PDQ Board: see Appendix B Power Header.

 

Mounting the board

Wildcard Bus Loading
Installing the Analog I/O Wildcard places special limits on the combination of other Wildcards that may be installed. For detailed information, please see: Wildcard Bus Loading Limits

To connect the Analog I/O Wildcard to the Wildcard bus on the controller board, follow these simple steps:

With the power off, connect the female 24-pin side of the stacking go-through Wildcard bus header on the bottom of the Analog I/O Wildcard to Wildcard Port 0 or Wildcard Port 1 on the Wildcard bus on the controller board. The corner mounting holes on the module should line up with the standoffs on the controller board. The module ports are labeled on the silkscreen of the controller board. Note that the Analog I/O Wildcard headers are configured to allow direct stacking onto the Wildcard bus, even if other Wildcards are also installed. Do not use ribbon cables to connect the Analog I/O Wildcard to the Wildcard bus. Use of ribbon cables on the Analog I/O Wildcard's field header is fine.

Be careful; the connectors are not keyed!
The Wildcard bus does not have keyed connectors. Be sure to insert the module so that all pins are connected. The Wildcard bus and the Analog I/O Wildcard can be permanently damaged if the connection is done incorrectly.
 

Selecting the Wildcard address

Once you have connected the Analog I/O Wildcard to the Wildcard bus, you must set the address of the module using jumper shunts across J1 and J2.

The Wildcard Select Jumpers, labeled J1 and J2, select a 2-bit code that sets a unique address on the Wildcard port of the Mosaic controller. Each Wildcard port on the Mosaic controller accommodates up to 4 Wildcards. Wildcard Port 0 provides access to modules 0-3 while Wildcard Port 1 provides access to modules 4-7. Two Wildcards on the same port cannot have the same address (jumper settings). The following table shows the possible jumper settings and the corresponding addresses.

Address Jumper Settings
Wildcard Port Wildcard Address Installed Jumper Shunts
0 0 None
0 1 J1
0 2 J2
0 3 J1 and J2
1 4 None
1 5 J1
1 6 J2
1 7 J1 and J2
Note:<block indent>Address 0 is not available on the QScreen or Handheld. Use addresses 1 through 7 instead.</block>
 

Selecting the reference voltage

The remaining jumpers on the Analog I/O Wildcard select the reference voltage for both the 12-bit DAC and the 16-bit A/D. These jumpers, referred to as the voltage reference selection jumpers, are labeled J3, J4, J5, and J6 and named DAC Ref, 4V Ref, 5V Ref, and Ref In/Out respectively.

In most applications the DAC uses its own internal reference, and the jumpers J3, J4, and J5 select one of 3 reference voltages for the A/D converter (the DAC reference output, the 4.096 V onboard reference, or the 5V reference, respectively). If installed, jumper J6 connects the A/D reference to pin 4 (VREF_PIN) on the Field Header.

The default configuration of the reference voltage selection jumpers is J4 and J6 installed. This connects the temperature-stable 4.096 reference voltage to the A/D reference input pin providing a 0 to 4.096 input range for each channel of the A/D. The default configuration also connects the 4.096 reference voltage to the reference pin on the Field Header (pin 4) for external connections. Using the default configuration requires that you initialize the DAC to generate its own reference voltage internally by passing the INT_1V_DAC12 or INT_2V_DAC12 parameters to the Init_Analog_IO function. This will allow the DAC to output voltages in the range of 0 to 2.048 volts or 0 to 4.096 volts respectively, as the maximum DAC output is twice the DAC reference voltage. The following sections describe the function of each jumper and list the valid jumper configuration options.

Watch the jumpers!
Not all jumper configurations are valid and certain invalid configurations may damage the module. So only place jumpers where they are required.
 

DAC reference jumper

The DAC reference jumper, labeled J3, and named "DAC Ref" on the silkscreen of the Analog I/O Wildcard, connects the DAC reference pin to the A/D reference input pin. The DAC reference voltage can be generated internally, or supplied externally by installing jumper J6. The DAC reference voltage is configured with the function Init_Analog_IO and the constants INT_1V_DAC12, INT_2V_DAC12, or EXT_DAC12. The following table summaries the configuration options available for the DAC reference voltage with a jumper shunt installed across J3:

DAC reference voltage configuration options with jumper J3 installed
Init_Analog_IO Option DAC Ref Pin State DAC Reference Pin Voltage A/D Reference Voltage DAC Output Range A/D Input Range
INT_1V_DAC12 Output 1.024 volts 1.024 volts 0 to 2.048 volts 0 to 1.024 volts
INT_2V_DAC12 Output 2.048 volts 2.048 volts 0 to 4.096 volts 0 to 2.048 volts
EXT_DAC12 Input Voltage on pin 4 of Field Header with J6 installed Voltage on pin 4 of Field Header with J6 installed 0 to 2x voltage on pin 4 of Field Header with J6 installed 0 to voltage on pin 4 of Field Header with J6 installed
 

4.096 volt reference jumper

The 4.096 Reference Jumper, labeled J4, and named "4V Ref" on the silkscreen of the Analog I/O Wildcard, connects the onboard 4.096 voltage reference to the reference input pin on the A/D. This configures the input range of the A/D as 0 to 4.096 volts. With this option, the DAC must be configured to generate its own reference voltage (using the INT_1V_DAC12 or INT_2V_DAC12 options with the Init_Analog_IO function).

 

5.0 volt reference jumper

The 5.0 Reference Jumper, labeled J5, and named "5V Ref" on the silkscreen of the Analog I/O Wildcard, connects the onboard 5 volt analog supply to the reference input pin on the A/D. This configures the input range of the A/D as 0 to 5.0 volts. With this option, the DAC must be configured to generate its own reference voltage (using the INT_1V_DAC12 or INT_2V_DAC12 options with the Init_Analog_IO function).

 

Reference in/out jumper

The Reference In/Out Jumper, labeled J6, connects the reference input pin of the A/D to the reference pin on the Field Header (pin 4). Install this jumper if the reference voltage is desired on the Field Header or an external reference voltage is required to drive the A/D or the DAC.

instrumentation:data-acquisition-16-bit-adc-12-bit-dac:waim_jumpers.png
Fig. 1  Jumper connections select reference voltages.

Above is a simplified schematic excerpt of the jumper connections, and the following table shows the valid jumper configurations for selecting the reference voltages. Be sure to use only a valid jumper configuration – other configurations may damage the Analog I/O Wildcard!

Valid Voltage Reference Jumper Configurations
Installed Jumpers Description
J4 & J6 Default Configuration. Connects the 4.096 internal reference voltage to the A/D reference input pin and to the reference pin on the Field Header. The DAC must be configured to generate an internal reference of 1.024 V or 2.048 V. A/D input range: 0 to 4.096 V. DAC output range: 0 to 2.048 V or 0 to 4.096 V.
J5 & J6 Connects the 5.0 analog supply voltage to the A/D reference input pin and to the reference pin on the Field Header. The DAC must be configured to generate an internal reference of 1.024 V or 2.048 V. A/D input range: 0 to 5.0 V. DAC output range: 0 to 2.048 V or 0 to 4.096 V.
J3 & J6 Connects the DAC reference pin to the A/D reference input pin and to the reference pin on the Field Header.

If the DAC is configured to generate an internal reference of 2.048 V, 2.048 V appears on pin 4 of the Field Header and the A/D reference input pin. A/D input range: 0 to 2.048 V. DAC output range: 0 to 4.096 V.

If the DAC is configured to generate an internal reference of 1.024 V, 1.024 V appears on pin 4 of the Field Header and the A/D reference input pin. A/D input range: 0 to 1.024 V. DAC output range: 0 to 2.048 V.

If the DAC is configured to use an external reference, the reference voltage that is supplied to pin 4 of the Field Header becomes the reference for both the A/D and the DAC. A/D input range: 0 to Vpin4. DAC output range: 0 to 2*Vpin4.
J6 Connects the ADC reference to the reference pin on the Field Header. You may supply an external reference to the ADC by connecting it to the Field Header, pin 4. You may use any reference voltage from 1 V to 5 V. The ADC loses accuracy if you supply a reference voltage of less than 1 V. The DAC may be configured to use its own internal reference, either 2.048 V for a DAC output range of 0 to 4.096 V, or 1.024 V for a DAC output range of 0 to 2.048 V.
J3 Connects the DAC reference pin to the A/D reference input pin. The DAC must be configured to generate an internal reference of 1.024 V or 2.048 V. The reference pin on Field Header is unconnected. A/D input range: 0 to 1.024 V or 0 to 2.048 V. DAC output range: 0 to 2.048 V or 0 to 4.096 V.
J4 Connects the 4.096 internal reference voltage to the A/D reference input pin. The reference pin on Field Header is unconnected. The DAC must be configured to generate an internal reference of 1.024 V or 2.048 V. A/D input range: 0 to 4.096 V. DAC output range: 0 to 2.048 V or 0 to 4.096 V.
J5 Connects the 5.0 analog supply voltage to the A/D reference input pin. The reference pin on Field Header is unconnected. The DAC must be configured to generate an internal reference of 1.024 V or 2.048 V. A/D input range: 0 to 5.0 V. DAC output range: 0 to 2.048 V or 0 to 4.096 V.
J3 & J4
J3 & J5
J4 & J5
J3 & J4 & J5

Never use these combinations – damage may result!
 

Properties of the 16-bit A/D

A/D transfer function

The 16-bit output code of the A/D is related to its input voltage as shown in the following figure:

A/D counts vs input voltage
Fig. 2  16-bit output code (A/D counts) vs input voltage transfer function

All 16-bit integers, from 0 through 216 – 1, as output codes are valid. The number of counts produced varies linearly from zero for zero voltage input, to the maximum count, 65535, for a voltage just a bit less than Vref. To compute the input voltage from the A/D counts, use the following equation:

VIN = +IN – -IN = ( Count / 65536 ) * Vref
 

A/D conversion accuracy

For detailed information regarding the converter's accuracy please consult the datasheet for the ADS8344. In brief, the accuracy and effective resolution of a conversion depends on a number of factors including the converters intrinsic noise and the source impedance.

 

Intrinsic noise error

The converter exhibits approximately 20 μVrms of effective input noise. When using a reference voltage range of 5 volts, the size of a least significant bit (lsb) is 76 μV, so this input noise corresponds to an error at about the 18 bit level (one quarter of the converter's lsb), and so does not compromise the performance of the converter. However, if the reference used is only 0.5 V, then the noise corresponds to appx. 3 lsb.

 

Source resistance error

Components and transducers with high output impedances connected to the analog inputs will introduce errors in the analog to digital converter. The following table shows the maximum source resistance at various sampling rates. Larger source resistances may cause conversion errors of more than one least significant bit (LSB).

Ideally the converter would be driven by a signal with low source resistance. However, a finite source resistance, combined with an A/D input impedance comprising a 25 pF capacitor and ± 1 µA leakage current, can compromise the converter's response via three mechanisms.

  1. The first and greatest source of error is input leakage current. The ADS8344's ± 1 µA leakage current is specified as "typical" over its operating temperature range of -40 to +80 °C. Like many other NMOS parts, the leakage current increases exponentially with temperature, with the "typical" value being merely a room temperature value. The actual leakage current may increase ten-fold at the upper temperature limit of +85 °C. The leakage current flowing through the source impedance creates a small input offset voltage. With a 4.096 V reference one lsb corresponds to 62.5 microvolts. Thus, 1 µA leakage current into a source impedance of 63 ohms may cause a one lsb error. Any greater source resistance would cause a correspondingly greater error; e.g., a 1 KΩ source resistance could produce as much as a ± 16 count error.
  2. The second source of error results from the requirement that the input capacitance of the converter must fully charge through the source resistance during an acquisition time of 2.25 μsec. To fully charge, the RC time constant should be much smaller than 2.25 μsec. This is usually easily attained. Allowing 16*LN(2) or eleven time constants for a large input change to charge with 16-bit precision produces the requirement that 11*RC < 2.25 μsec, or R < 2.25 μsec / (11*25 pF), or R < 8 KΩ.
  3. The third source of error results from the average input capacitance current flowing through the source resistance. The capacitance must charge repeatedly at the sample rate, producing an average current through the source impedance, and resulting in an average voltage drop across it. To assure less than one lsb error we need fRC < 2-16 or R < 2-16/fC. At a sample rate of 1 Ksps, R < 610 ohms.

Combining these effects, we see that for a one lsb error the maximum source impedance should be less than 57 ohms at a sample rate of 1 Ksps, and less than 40 ohms at 5 Ksps. If the device is operated at an elevated temperature the input leakage current may increase causing much greater errors. Consequently, our recommendation is to drive the inputs from the output of an op-amp.

Maximum Source Resistance vs Sampling Rates
Sample Rate
(samples per second)
Maximum Source Resistance
< 1 K 60 Ohms
1 K 57 Ohms
2 K 50 Ohms
5 K 40 Ohms
10 K 30 Ohms
20 K 20 Ohms

For more detailed specifications for the A/D, consult its datasheet.

 

Properties of the 12-bit DAC

DAC transfer function

Each channel of the DAC generates an output voltage proportional to the digital input code (counts) sent to it, as,

Vout = 2 · Vref · Counts / 212 = 2 · Vref · Counts / 4096

where the DAC's digital input code, Counts, is within the range of 0 to 212-1 (that is, 0 – 4095).

The full scale DAC output voltage is double the reference voltage you specify. That is,

  • If Vref = 1.024 V the output voltage range is 0 – 2.047 V.
  • If Vref = 2.048 V the output voltage range is 0 – 4.095 V.
 

DAC accuracy and errors

The most salient characteristics of the DAC related to its accuracy and allowed load conditions are the following:

Parameter Value
Output load resistance > 2 KΩ
Output load regulation ± 0.3 %FS max for RL= 2 KΩ to 10 KΩ
Output load capacitance < 100 pF
Integral nonlinearity (from 40 to 4095) ± 2 LSB typically
Differential nonlinearity (from 40 to 4095) ± 0.5 LSB typically
Zero offset ± 30 mV maximum
Zero offset temperature coefficient 30 μV typically
Gain error ± 0.6 %FS
Gain error temperature coefficient 10 ppm/°C typically
Low reference voltage 1.010 – 1.040 (1.024 typically)
High reference voltage 2.020 – 2.096 (2.048 typically)
Output settling time 1 μsec typically

The most important source of error, from a practical standpoint, is the output's zero offset voltage, which can be as great as ± 30 mV, corresponding to ± 30 counts when using a 2.048 V reference (and a full scale output of 4.095 V). In most applications that error may not be significant, but it does mean that the output does not have the property of "positive shutoff", required by some control applications. If in your application you need to guarantee a zero output, you will need to bias the output down using external circuitry. A simple resistor to a negative voltage is sufficient.

For more detailed DAC specifications, consult theTLV5630 datasheet.

 

Connecting to the field header

The analog inputs and outputs are brought out to a 24-pin dual row header on the Analog I/O Wildcard as shown in the following table.

Analog I/O Wildcard Field Header
Signal Pins Signal
GND – 1 2 – +5V
VAN – 3 4 – REF
ADCGND – 5 6 – ADCGND
AD16_CH7 – 7 8 – AD16_CH6
AD16_CH5 – 9 10 – AD16_CH4
AD16_CH3 – 11 12 – AD16_CH2
AD16_CH1 – 13 14 – AD16_CH0
DACGND – 15 16 – DACGND
DAC12_CH7 – 17 18 – DAC12_CH6
DAC12_CH5 – 19 20 – DAC12_CH4
DAC12_CH3 – 21 22 – DAC12_CH2
   DAC12_CH1 – 23 24 – DAC12_CH0   

To connect your transducer signals or control inputs to the Field Bus (H3 on the Analog I/O Wildcard) use a ribbon cable or the Screw Terminal Module that brings out the signals to screw terminal blocks. Shielding the connecting wires is highly recommended for optimal performance.

 

Using the software driver

A package of pre-coded device driver functions is provided to make it easy to use the Analog I/O Wildcard. This code is available as a pre-compiled "kernel extension" library to C and Forth programmers.

 

Installing the driver software

Instructions for PDQ

Instructions for QED/Q-line

 

Overview of the 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 corresponds to the hardware address jumper settings as described above.

 

Initializing the 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 Counts, and outputs a voltage given by,

Vout = 2 · Vref · Counts / 4096

There are three different options for Vref:

  • 2.048 V — 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.
  • 1.024 V — 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.
  • External Vref — 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 external reference voltage is 5 volts. However, voltages above 2.048 volts will result in degraded performance of the DAC. Also, the DAC's maximum specified output voltage is 4.6 volts, corresponding to an external reference of 2.3 V.

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 on channel DAC 0 (pin 24 on the Field Header), use the function To_DAC12 as shown in Listings 1-1 and 1-2.

C Code for outputting 2.000 volts to Channel 0 on Module 0

#include <mosaic/allqed.h>
#ifdef __GNUC__
#include <waim.h>
#else
#include "library.h"
#include "library.c"
#endif
#define ANALOG_MODULE0 0                       // define current module
void main ( void )
{
  Init_Analog_IO(INT_2V_DAC12,ANALOG_MODULE0); // init DAC to use 2.048 int ref
  To_DAC12( 2000, DAC12_CH0, ANALOG_MODULE0);  // output 2.000 volts to ch 0
}

Forth Code for outputting 2.000 volts to Channel 0 on Module 0

DECIMAL                                    \ set base to decimal
0 CONSTANT ANALOG_MODULE0                  \ define current module
INT_2V_DAC12 ANALOG_MODULE0 Init_Analog_IO \ init DAC to use 2.048 internal ref
2000 DAC12_CH0 ANALOG_MODULE0 To_DAC12     \ output 2.000 volts to channel 0

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. Listings 1-3 and 1-4 demonstrate how to use the Delay_Update_DAC12 and Update_DAC12 functions to simultaneously write a stair-step pattern to all eight output channels of a DAC.

C Code for using ''Delay_Update_DAC12'' and ''Update_DAC12''

#include <mosaic/allqed.h>
#ifdef __GNUC__
#include <waim.h>
#else
#include "library.h"
#include "library.c"
#endif
#define ANALOG_MODULE0 0                       // define current module
void main ( void )
{
  Init_Analog_IO(INT_2V_DAC12,ANALOG_MODULE0); // init DAC to use 2.048 int ref
  Delay_Update_DAC12( ANALOG_MODULE0 );        // delay DAC update
  To_DAC12( 0500, DAC12_CH0, ANALOG_MODULE0);  // output 0.5 volts to ch 0
  To_DAC12( 1000, DAC12_CH1, ANALOG_MODULE0);  // output 1.0 volts to ch 1
  To_DAC12( 1500, DAC12_CH2, ANALOG_MODULE0);  // output 1.5 volts to ch 2
  To_DAC12( 2000, DAC12_CH3, ANALOG_MODULE0);  // output 2.0 volts to ch 3
  To_DAC12( 2500, DAC12_CH4, ANALOG_MODULE0);  // output 2.5 volts to ch 4
  To_DAC12( 3000, DAC12_CH5, ANALOG_MODULE0);  // output 3.0 volts to ch 5
  To_DAC12( 3500, DAC12_CH6, ANALOG_MODULE0);  // output 3.5 volts to ch 6
  To_DAC12( 4000, DAC12_CH7, ANALOG_MODULE0);  // output 4.0 volts to ch 7
  Update_DAC12( ANALOG_MODULE0 );             // simultaneously update all dacs
}

Forth Code for using ''Delay_Update_DAC12'' and ''Update_DAC12''

DECIMAL                                      \ set base to decimal
0 CONSTANT ANALOG_MODULE0                    \ define current module
: STAIR_STEP ( -- )
  INT_2V_DAC12 ANALOG_MODULE0 Init_Analog_IO \ init DAC to use 2.048 int ref
  ANALOG_MODULE0 Delay_Update_DAC12          \ delay DAC update
  0500 DAC12_CH0 ANALOG_MODULE0 To_DAC12     \ output 0.5 volts to channel 0
  1000 DAC12_CH1 ANALOG_MODULE0 To_DAC12     \ output 1.0 volts to channel 1
  1500 DAC12_CH2 ANALOG_MODULE0 To_DAC12     \ output 1.5 volts to channel 2
  2000 DAC12_CH3 ANALOG_MODULE0 To_DAC12     \ output 2.0 volts to channel 3
  2500 DAC12_CH4 ANALOG_MODULE0 To_DAC12     \ output 2.5 volts to channel 4
  3000 DAC12_CH5 ANALOG_MODULE0 To_DAC12     \ output 3.0 volts to channel 5
  3500 DAC12_CH6 ANALOG_MODULE0 To_DAC12     \ output 3.5 volts to channel 6
  4000 DAC12_CH7 ANALOG_MODULE0 To_DAC12     \ output 4.0 volts to channel 7
  ANALOG_MODULE0 Update_DAC12                \ simultaneously update all dacs
;
 

Using the A/D drivers

The eight input lines of the Analog I/O Wildcard can be configured as either eight 16-bit unipolar single-ended input channels or four 16-bit unipolar-differential input channels. In single-ended configuration, the convertor can digitize only positive ground-referenced voltages. Each differential channel pair can also only convert a positive differential voltage, but the channel pair can be reconfigured to swap the polarity of the inputs so that a negative difference voltage can also be read. Consequently the four differential inputs can each be reconfigured so that there are a total of eight differential input combinations.

The A/D converts the positive voltage difference between a greater, "positive" input (+IN) and a lesser, "negative" input (–IN ) into a digital number in the range 0 to 65535, with 0 corresponding to +IN = –IN (or +IN ≤ –IN) and 65535 corresponding to +IN – –IN > Vref · 65534.5/65536. If the voltage on the –IN pin is greater than that of the +IN pin, the conversion result is zero.

In single-ended mode the –IN input is connected to ground and eight input channels of +IN are provided for reading positive voltages referenced to ground. In differential mode, the +IN and –IN are assigned to different input channels, and the positive voltage difference, +IN minus –IN, is converted. The –IN input must be kept within the range –0.2 V to +1.25 V, and should not be greater than the +IN input. The +IN input must be kept within the range –0.2 V to +5.2 V and produces meaningful results for values from the –IN input value up to the –IN input value plus the reference voltage. Because both the +IN and –IN input voltage ranged extend well below ground (to –0.2 V), voltage differences near or slightly below ground can be read. Further, the +IN can range up to 5.2 V.

The sixteen different input options are itemized as follows:

Analog Input Connection Options
Constant to use Positive input (+IN) Negative input (–IN) Type
AD16_CH0  AD16_CH0 (pin 14)  ADCGND (pin 5,6) Single Ended
AD16_CH1  AD16_CH1 (pin 13)  ADCGND (pin 5,6) Single Ended
AD16_CH2  AD16_CH2 (pin 12)  ADCGND (pin 5,6) Single Ended
AD16_CH3  AD16_CH3 (pin 11)  ADCGND (pin 5,6) Single Ended
AD16_CH4  AD16_CH4 (pin 10)  ADCGND (pin 5,6) Single Ended
AD16_CH5  AD16_CH5 (pin 9)  ADCGND (pin 5,6) Single Ended
AD16_CH6  AD16_CH6 (pin 8)  ADCGND (pin 5,6) Single Ended
AD16_CH7  AD16_CH7 (pin 7)  ADCGND (pin 5,6) Single Ended
AD16_CH0_CH1  AD16_CH0 (pin 14)  AD16_CH1 (pin 13) Differential
AD16_CH1_CH0  AD16_CH1 (pin 13)  AD16_CH0 (pin 14) Differential
AD16_CH2_CH3  AD16_CH2 (pin 12)  AD16_CH3 (pin 11) Differential
AD16_CH3_CH2  AD16_CH3 (pin 11)  AD16_CH2 (pin 12) Differential
AD16_CH4_CH5  AD16_CH4 (pin 10)  AD16_CH5 (pin 9) Differential
AD16_CH5_CH4  AD16_CH5 (pin 9)  AD16_CH4 (pin 10) Differential
AD16_CH6_CH7  AD16_CH6 (pin 8)  AD16_CH7 (pin 7) Differential
AD16_CH7_CH6  AD16_CH7 (pin 7)  AD16_CH6 (pin 8) Differential

To read a voltage from channel 2 (pin 12 on the Field Header) on module 1 with a single-ended conversion, use the function AD16_Sample as shown in the example code Listings 1-5 and 1-6.

C Code for reading A/D Channel 2 on Module 1

#include <mosaic/allqed.h>
#ifdef __GNUC__
#include <waim.h>
#else
#include "library.h"
#include "library.c"
#endif
#define ANALOG_MODULE_NUM 1                       // define current module as 1
void main ( void )
{
  uint ad16_result;
  Init_Analog_IO(INT_2V_DAC12,ANALOG_MODULE_NUM); // init DAC to use 2.048 int ref
  ad16_result = AD16_Sample( AD16_CH2, ANALOG_MODULE_NUM ); // read ch 2 on mod 1
  printf("AD Result = %u\n",ad16_result);      // print out A/D counts
}

Forth Code for reading A/D Channel 2 on Module 1

DECIMAL                                       \ set base to decimal
1 CONSTANT ANALOG_MODULE_NUM                  \ define current module as 1
INT_2V_DAC12 ANALOG_MODULE_NUM Init_Analog_IO \ init DAC to use 2.048 internal ref
AD16_CH2 ANALOG_MODULE_NUM AD16_Sample        \ read sample from ch 2 on mod 1
U.                                            \ print out A/D counts

Convert the 16-bit result returned from AD16_Sample into a voltage, using Equation 1 above, or,

VIN = +IN – -IN = ( Count / 65536 ) * Vref

Vref is the reference voltage selected using the voltage reference selection jumpers which were described in the section entitled "Selecting The Reference Voltage". 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. See the glossary entry for more information.

 

Using the driver code from C

The C demo is located in your installation directory. It is also provided here for reference.

Instructions for PDQ

Instructions for QED/Q-line

 

Using the driver code from Forth

The Forth demo is located in your installation directory. It is also provided here for reference.

Instructions for PDQ

Instructions for QED/Q-line

 

Glossary

Schematics and datasheets

For more detailed specifications for the input characteristics of the 16-bit A/D, or the output characteristics of the 12-bit DAC, please consult the appropriate datasheet:

For a thorough understanding of the design of the Analog I/O Wildcard, see the schematics below, provided as printable PDF files and images for screen viewing. If you have any questions that can not be answered by the datasheets or the schematics, please feel free to contact Mosaic Industries.

W-AIM Digital Logic

W-AIM Analog I/O



See also → 

 
This page is about: 16-bit ADC & 12-bit DAC for Instrumentation and Control, 16-bit Analog to Digital Converter – Precise 16-bit analog voltage measurements with this analog to digital converter expansion i/o module for sensor measurement 16 bit adc, 12 bit dac, analog and digital signals, d/a converter, a/d converter, analog reference, controller board, high output impedance, digital logic circuitry, samples per second
 
 
Navigation