The Analog I/O Wildcard provides eight 12-bit digital to analog (DAC) outputs and eight 16-bit analog to digital (A/D) inputs. This tiny 2” by 2.5” module is a member of the Wildcard™ series that connects directly to Mosaic embedded controllers.
This document describes the capabilities of the Analog I/O Wildcard, tells how to configure the hardware, and presents an overview of the driver software. A glossary of the software functions and complete hardware schematics are also included.
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. 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 Table 1-1.
| 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 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 10V/μ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 samples per second |
| Power Requirements | |
|---|---|
| Current: | 70 mA at 5V |
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.
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). Table 1-2 shows the possible jumper settings and the corresponding addresses.
Table 1-2 Jumper Settings and Associated Addresses
| Wildcard Port | Wildcard Address | Installed Jumper Shunts |
|---|---|---|
| 0 | 0 | None |
| 1 | J1 | |
| 2 | J2 | |
| 3 | J1 and J2 | |
| 1 | 4 | None |
| 5 | J1 | |
| 6 | J2 | |
| 7 | J1 and J2 | |
| Note that address 0 is not available on the QScreen or Handheld. Use addresses 1 through 7 instead. |
||
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.096V 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
More…
Close
C: INT_1V_DAC12
A constant (= 0x04) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 1.024 volt as its reference. With this option, the DAC output range is from 0 to 2.048 volts.
See also Init_Analog_IO.
C: INT_2V_DAC12
A constant (= 0x06) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 2.048 volt as its reference. With this option, the DAC output range is 0 to 4.096 volts.
See also Init_Analog_IO.
C: void Init_Analog_IO ( int reference_option, int module_num )
Initializes the software drivers for the 12-bit DAC and the 16-bit A/D, sets the reference voltage of the DAC to the specified option on the specified module, and sets all 8 DAC channels to 0 volts. The reference option is selected using one of the following constants: INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12. The eight valid module numbers are 0 to 7. See also INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12.
4th: INT_1V_DAC12 ( -- n )
4th: INT_2V_DAC12 ( -- n )
4th: Init_Analog_IO ( reference_option\module_num -- )
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
More…
Close
C: void Init_Analog_IO ( int reference_option, int module_num )
Initializes the software drivers for the 12-bit DAC and the 16-bit A/D, sets the reference voltage of the DAC to the specified option on the specified module, and sets all 8 DAC channels to 0 volts. The reference option is selected using one of the following constants: INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12. The eight valid module numbers are 0 to 7. See also INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12.
C: INT_1V_DAC12
A constant (= 0x04) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 1.024 volt as its reference. With this option, the DAC output range is from 0 to 2.048 volts.
See also Init_Analog_IO.
C: INT_2V_DAC12
A constant (= 0x06) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 2.048 volt as its reference. With this option, the DAC output range is 0 to 4.096 volts.
See also Init_Analog_IO.
C: EXT_DAC12
A constant (= 0x00) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use the voltage on the reference pin of the Analog I/O Field Header, pin 4 as its reference if jumper J6 is installed.
See also Init_Analog_IO.
4th: Init_Analog_IO ( reference_option\module_num -- )
4th: INT_1V_DAC12 ( -- n )
4th: INT_2V_DAC12 ( -- n )
4th: EXT_DAC12 ( -- n )
Table 1-3 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
More…
Close
C: INT_1V_DAC12
A constant (= 0x04) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 1.024 volt as its reference. With this option, the DAC output range is from 0 to 2.048 volts. See also Init_Analog_IO. | Output | 1.024 volts | 1.024 volts | 0 to 2.048 volts | 0 to 1.024 volts |
| INT_2V_DAC12
More…
Close
C: INT_2V_DAC12
A constant (= 0x06) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 2.048 volt as its reference. With this option, the DAC output range is 0 to 4.096 volts. See also Init_Analog_IO. | Output | 2.048 volts | 2.048 volts | 0 to 4.096 volts | 0 to 2.048 volts |
| EXT_DAC12
More…
Close
C: EXT_DAC12
A constant (= 0x00) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use the voltage on the reference pin of the Analog I/O Field Header, pin 4 as its reference if jumper J6 is installed. See also Init_Analog_IO. | 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 |
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
More…
Close
C: INT_1V_DAC12
A constant (= 0x04) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 1.024 volt as its reference. With this option, the DAC output range is from 0 to 2.048 volts.
See also Init_Analog_IO.
C: INT_2V_DAC12
A constant (= 0x06) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 2.048 volt as its reference. With this option, the DAC output range is 0 to 4.096 volts.
See also Init_Analog_IO.
C: void Init_Analog_IO ( int reference_option, int module_num )
Initializes the software drivers for the 12-bit DAC and the 16-bit A/D, sets the reference voltage of the DAC to the specified option on the specified module, and sets all 8 DAC channels to 0 volts. The reference option is selected using one of the following constants: INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12. The eight valid module numbers are 0 to 7. See also INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12.
4th: INT_1V_DAC12 ( -- n )
4th: INT_2V_DAC12 ( -- n )
4th: Init_Analog_IO ( reference_option\module_num -- )
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
More…
Close
C: INT_1V_DAC12
A constant (= 0x04) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 1.024 volt as its reference. With this option, the DAC output range is from 0 to 2.048 volts.
See also Init_Analog_IO.
C: INT_2V_DAC12
A constant (= 0x06) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 2.048 volt as its reference. With this option, the DAC output range is 0 to 4.096 volts.
See also Init_Analog_IO.
C: void Init_Analog_IO ( int reference_option, int module_num )
Initializes the software drivers for the 12-bit DAC and the 16-bit A/D, sets the reference voltage of the DAC to the specified option on the specified module, and sets all 8 DAC channels to 0 volts. The reference option is selected using one of the following constants: INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12. The eight valid module numbers are 0 to 7. See also INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12.
4th: INT_1V_DAC12 ( -- n )
4th: INT_2V_DAC12 ( -- n )
4th: Init_Analog_IO ( reference_option\module_num -- )
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.
Table 1-4 shows the valid jumper configurations for selecting the reference voltage. Jumper configurations that are not shown in the table may damage the Analog I/O Wildcard!
Table 1-4 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.024V or 2.048V. A/D input range: 0 to 4.096V. DAC output range: 0 to 2.048V or 0 to 4.096V. |
| 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.024V or 2.048V. A/D input range: 0 to 5.0V. DAC output range: 0 to 2.048V or 0 to 4.096V. |
| 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.048V, 2.048V appears on pin 4 of the Field Header and the A/D reference input pin. A/D input range: 0 to 2.048V. DAC output range: 0 to 4.096V. If the DAC is configured to generate an internal reference of 1.024V, 1.024V appears on pin 4 of the Field Header and the A/D reference input pin. A/D input range: 0 to 1.024V. DAC output range: 0 to 2.048V. 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. |
| 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.024V or 2.048V. The reference pin on Field Header is unconnected. A/D input range: 0 to 1.024V or 0 to 2.048V. DAC output range: 0 to 2.048V or 0 to 4.096V. |
| 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.024V or 2.048V. A/D input range: 0 to 4.096v. DAC output range: 0 to 2.048V or 0 to 4.096V. |
| 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.024V or 2.048V. A/D input range: 0 to 5.0v. DAC output range: 0 to 2.048V or 0 to 4.096V. |
| J3 & J4 J3& J5 J4 & J5 J3 & J4 & J5 | Never use these combinations – damage may result! |
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.
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.
Components and transducers with high output impedances connected to the analog inputs will introduce errors in the analog to digital converter. Table 1-5 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.
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.
Table 1-5 Maximum Source Resistance at Various Sampling Rates
| Sample Rate (samples per second) | Maximum Source Resistance |
|---|---|
| < 1K | 60 Ohms |
| 1 K | 57 Ohms |
| 2 K | 50 Ohms |
| 5 K | 40 Ohms |
| 10 K | 30 Ohms |
| 20 K | 20 Ohms |
The analog inputs and outputs are brought out to a 24-pin dual row header on the Analog I/O Wildcard as shown in Table 1-6.
Table 1-6 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.
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.
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 as described in Table 1-2 above.
Use Init_Analog_IO
More…
Close
C: void Init_Analog_IO ( int reference_option, int module_num )
Initializes the software drivers for the 12-bit DAC and the 16-bit A/D, sets the reference voltage of the DAC to the specified option on the specified module, and sets all 8 DAC channels to 0 volts. The reference option is selected using one of the following constants: INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12. The eight valid module numbers are 0 to 7. See also INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12.
C: void Init_Analog_IO ( int reference_option, int module_num )
Initializes the software drivers for the 12-bit DAC and the 16-bit A/D, sets the reference voltage of the DAC to the specified option on the specified module, and sets all 8 DAC channels to 0 volts. The reference option is selected using one of the following constants: INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12. The eight valid module numbers are 0 to 7. See also INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12.
C: INT_2V_DAC12
A constant (= 0x06) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 2.048 volt as its reference. With this option, the DAC output range is 0 to 4.096 volts.
See also Init_Analog_IO.
C: INT_1V_DAC12
A constant (= 0x04) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use its own internally generated 1.024 volt as its reference. With this option, the DAC output range is from 0 to 2.048 volts.
See also Init_Analog_IO.
C: EXT_DAC12
A constant (= 0x00) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use the voltage on the reference pin of the Analog I/O Field Header, pin 4 as its reference if jumper J6 is installed.
See also Init_Analog_IO.
C: void Init_Analog_IO ( int reference_option, int module_num )
Initializes the software drivers for the 12-bit DAC and the 16-bit A/D, sets the reference voltage of the DAC to the specified option on the specified module, and sets all 8 DAC channels to 0 volts. The reference option is selected using one of the following constants: INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12. The eight valid module numbers are 0 to 7. See also INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12.
4th: Init_Analog_IO ( reference_option\module_num -- )
4th: Init_Analog_IO ( reference_option\module_num -- )
4th: INT_2V_DAC12 ( -- n )
4th: INT_1V_DAC12 ( -- n )
4th: EXT_DAC12 ( -- n )
4th: Init_Analog_IO ( reference_option\module_num -- )
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 Equation 1-1.
Vout = 2 * Vref * (N/4096) Eqn. 1-1
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
More…
Close
C: EXT_DAC12
A constant (= 0x00) that, when passed as a parameter to the Init_Analog_IO function, configures the 12-bit DAC to use the voltage on the reference pin of the Analog I/O Field Header, pin 4 as its reference if jumper J6 is installed.
See also Init_Analog_IO.
C: void Init_Analog_IO ( int reference_option, int module_num )
Initializes the software drivers for the 12-bit DAC and the 16-bit A/D, sets the reference voltage of the DAC to the specified option on the specified module, and sets all 8 DAC channels to 0 volts. The reference option is selected using one of the following constants: INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12. The eight valid module numbers are 0 to 7. See also INT_2V_DAC12, INT_1V_DAC12, and EXT_DAC12.
4th: EXT_DAC12 ( -- n )
4th: Init_Analog_IO ( reference_option\module_num -- )
The constants that are associated with the DAC output channels are DAC12_CH0
More…
Close
C: DAC12_CH0
A constant (= 0x00) that, when passed as a parameter to the To_DAC12 function, configures the 12-bit DAC to output a voltage on Channel 0, pin 24, of the Analog I/O Field Header.
See also To_DAC12.
C: DAC12_CH1
A constant (= 0x10) that, when passed as a parameter to the To_DAC12 function, configures the 12-bit DAC to output a voltage on Channel 1, pin 23, of the Analog I/O Field Header.
See also To_DAC12.
C: DAC12_CH2
A constant (= 0x20) that, when passed as a parameter to the To_DAC12 function, configures the 12-bit DAC to output a voltage on Channel 2, pin 22, of the Analog I/O Field Header.
See also To_DAC12.
C: DAC12_CH3
A constant (= 0x30) that, when passed as a parameter to the To_DAC12 function, configures the 12-bit DAC to output a voltage on Channel 3, pin 21, of the Analog I/O Field Header.
See also To_DAC12.
C: DAC12_CH4
A constant (= 0x40) that, when passed as a parameter to the To_DAC12 function, configures the 12-bit DAC to output a voltage on Channel 4, pin 20, of the Analog I/O Field Header.
See also To_DAC12.
C: DAC12_CH5
A constant (= 0x50) that, when passed as a parameter to the To_DAC12 function, configures the 12-bit DAC to output a voltage on Channel 5, pin 19, of the Analog I/O Field Header.
See also To_DAC12.
C: DAC12_CH6
A constant (= 0x60) that, when passed as a parameter to the To_DAC12 function, configures the 12-bit DAC to output a voltage on Channel 6, pin 18, of the Analog I/O Field Header.
See also To_DAC12.
C: DAC12_CH7
A constant (= 0x70) that, when passed as a parameter to the To_DAC12 function, configures the 12-bit DAC to output a voltage on Channel 7, pin 17, of the Analog I/O Field Header.
See also To_DAC12.
C: void To_DAC12 ( int value, int channel_num, int module_num )
Writes the specified 12-bit value to the specified channel of the 12-bit DAC on the specified module. The eight valid module numbers are 0 to 7 while the channel number is specified with one of the constants DAC12_CH0, DAC12_CH1, DAC12_CH2, DAC12_CH3, DAC12_CH4, DAC12_CH5, DAC12_CH6, and DAC12_CH7. The 12-bit value is clamped to the range of 0 to 4095 but no error checking is performed on the channel number or the module number. Init_Analog_IO must be called before calling To_DAC12 to initialize the DAC's reference voltage. Unlike the routines for the 8-bit DAC and 12-bit A/D, a resource variable is not needed for the 12-bit DAC and the 16-bit A/D in multitasking systems. To_DAC12 executes in approximately 37 microseconds and disables interrupts for 16.5 microseconds.
See also Init_Analog_IO.
4th: DAC12_CH0 ( -- n )
4th: DAC12_CH1 ( -- n )
4th: DAC12_CH2 ( -- n )
4th: DAC12_CH3 ( -- n )
4th: DAC12_CH4 ( -- n )
4th: DAC12_CH5 ( -- n )
4th: DAC12_CH6 ( -- n )
4th: DAC12_CH7 ( -- n )
4th: To_DAC12 ( value\channel_num\module_num -- )
Listing 1-1 C Code Listing for outputing 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 }
Listing 1-2 Forth Code Listing for outputing 2.048 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
More…
Close
C: void To_All_DACs ( int value, int module_num )
Writes the specified 12-bit value simultaneously to all channels of the 12-bit DAC on the specified module. To_All_DACs uses the functions Delay_Update_DAC12 and Update_DAC12 to output all voltages to all channels at the same time. The eight valid module numbers are 0 to 7. The 12-bit value is clamped to the range of 0 to 4095 but no error checking is performed on the module number. Init_Analog_IO must be called before this routine initialize the reference voltage of the DAC.
See also Init_Analog_IO, Delay_Update_DAC12, and Update_DAC12.
C: void To_All_DACs ( int value, int module_num )
Writes the specified 12-bit value simultaneously to all channels of the 12-bit DAC on the specified module. To_All_DACs uses the functions Delay_Update_DAC12 and Update_DAC12 to output all voltages to all channels at the same time. The eight valid module numbers are 0 to 7. The 12-bit value is clamped to the range of 0 to 4095 but no error checking is performed on the module number. Init_Analog_IO must be called before this routine initialize the reference voltage of the DAC.
See also Init_Analog_IO, Delay_Update_DAC12, and Update_DAC12.
C: void Delay_Update_DAC12 ( int module_num )
Configures the 12-bit DAC to accept 12-bit values for each DAC channel but to delay outputting the voltage to the corresponding pin of the DAC until Update_DAC12 is called. This option is disabled by default and is typically used to simultaneously set the output voltages of all 12-bit DAC channels.
See also Update_DAC12 and To_All_DACs.
C: void Update_DAC12 ( int module_num )
Configures the 12-bit DAC to immediately output a voltage on each DAC channel corresponding to the last 12-bit value written to the channel. This option is enabled by default and is typically used after a call to the Delay_Update_DAC12 routine.
See also Delay_Update_DAC12.
See also → Analog I/O Wildcard User Guide
4th: To_All_DACs ( value\module_num -- )
4th: To_All_DACs ( value\module_num -- )
4th: Delay_Update_DAC12 ( module_num -- )
4th: Update_DAC12 ( module_num -- )
Listing 1-3 C Code Listing for using Delay_Update_DAC12
More…
Close
C: void Delay_Update_DAC12 ( int module_num )
Configures the 12-bit DAC to accept 12-bit values for each DAC channel but to delay outputting the voltage to the corresponding pin of the DAC until Update_DAC12 is called. This option is disabled by default and is typically used to simultaneously set the output voltages of all 12-bit DAC channels.
See also Update_DAC12 and To_All_DACs.
C: void Update_DAC12 ( int module_num )
Configures the 12-bit DAC to immediately output a voltage on each DAC channel corresponding to the last 12-bit value written to the channel. This option is enabled by default and is typically used after a call to the Delay_Update_DAC12 routine.
See also Delay_Update_DAC12.
See also → Analog I/O Wildcard User Guide
4th: Delay_Update_DAC12 ( module_num -- )
4th: Update_DAC12 ( module_num -- )
#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 }
Listing 1-4 Forth Code Listing 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 ;
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 65536, with 0 corresponding to +IN = –IN and 65535 corresponding to +IN – –IN = Vref. 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.2V), voltage differences near or slightly below ground can be read. Further, the +IN can range up to 5.2V.
The sixteen different input options are itemized in Table 1-7.
Table 1-7 Analog Input Connection Options
| Associated Constant | 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.
Listing 1-5 C Code Listing 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_MODULE0 0 // define current module void main ( void ) { uint ad16_result; Init_Analog_IO(INT_2V_DAC12,ANALOG_MODULE0); // init DAC to use 2.048 int ref ad16_result = AD16_Sample( AD16_CH2, ANALOG_MODULE0 ); // read ch 2 on mod 1 printf("AD Result = %u\n",ad16_result); // print out A/D counts }
Listing 1-6 Forth Code Listing for reading A/D Channel 2 on Module 1.
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 AD16_CH2 ANALOG_MODULE0 AD16_Sample \ read sample from ch 2 on mod 1 U. \ print out A/D counts
To convert the 16-bit result returned from AD16_Sample into a voltage, use Equation 1-2.
Vref in Equation 1-2 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.
Library.c and library.h are only needed if you are programming in C. Library.4th is only needed if you are programming in Forth. The uses of all of these files are explained below.
We recommend that you move the relevant files to the same directory that contains your application source code.
To use the kernel extension, the runtime kernel extension code contained in the install.txt file must first be loaded into the flash memory of the Mosaic Controller. Start the QED Terminal software with the Mosaic Controller connected to the serial port and turned on. If you have not yet tested your Mosaic Controller and terminal software, please refer to the documentation provided with the QED Terminal software. Once you can hit enter and see the 'ok' prompt returned in the terminal window, type
COLD
to ensure that the board is ready to accept the kernel extension install file. Use the “Send File” menu item of the terminal to download the install.txt to the Mosaic Controller.
Now, type
COLD
again and the kernel has been extended! Once install.txt has been loaded, it does not need to be reloaded each time you revise your source code.
The C demo is located in your installation directory. It is also provided here for reference.
#include <mosaic/allqed.h> //__GNUC__ is true for Mosaic PDQ IDE #ifdef __GNUC__ #include <waim.h> #else #include "library.h" #include "library.c" #endif
All you need to do is include “waim.h” and all the linking is taken care of automatically
#include "library.c"
This file contains calling primitives that implement the functions in the kernel extension package. The library.c file automatically includes the library.h header file. If you have a project with multiple source code files, you should only include library.c once, but use the directive
#include "library.h"
in every additional source file that references the Analog I/O functions.
Note that all of the functions in the kernel extension are of the _forth type. While they are fully callable from C, there are two important restrictions. First, _forth functions may not be called as part of a parameter list of another _forth function. Second, _forth functions may not be called from within an interrupt service routine unless the instructions found in the file named
\fabius\qedcode\forthirq.c
are followed.
NOTE: If your compiler was purchased before June 2002, you must update the files, qlink.bat and qmlink.bat in your /fabius/bin directory on your installation before using the kernel extension. You can download a zip file of new versions at
http://www.mosaic-industries.com/Download/new_qlink.zip
The two new files should be placed in c:\Fabius\bin. This upgrade only has to be done once for a given installation of the C compiler.
The Forth demo is located in your installation directory. It is also provided here for reference.
MosaicPDQ\forth\demos\Analog_IO_Wildcard\aimdemo_loader.4TH
Type
aim_demo
to start the demo.
The loader first includes waim.fin. This file must be sent before any application code is loaded. This file is stored in non-volatile flash and will still be available after a cold restart. Although you can load the .fin file every time, we provide a .qfin file which should only be loaded after the .fin file is sent and cold is executed. The .qfin file is shorter and provides the headers to access the driver stored flash memory by the .fin file.
WHICH.MAP 0= IFTRUE 4 PAGE.TO.RAM \ if in standard.map... 5 PAGE.TO.RAM 6 PAGE.TO.RAM DOWNLOAD.MAP ENDIFTRUE
This moves all pre-loaded flash contents to RAM if the Mosaic Controller is in the standard (flash-based) memory map, and then establishes the download (RAM-based) memory map. At the end of this sequence the Mosaic Controller is in the download map, ready to receive additional code.
We recommend that your source code file end with the sequence:
4 PAGE.TO.FLASH 5 PAGE.TO.FLASH 6 PAGE.TO.FLASH STANDARD.MAP SAVE
This copies all loaded code from RAM to flash, and sets up the standard (flash-based) memory map with code located in pages 4, 5 and 6. The SAVE command means that you can often recover from a crash and continue working by typing RESTORE as long as flash pages 4, 5 and 6 haven't been rewritten with any bad data.
Analog I/O Wildcard schematic page 1 a a pdf
Analog I/O Wildcard schematic page 2 a a pdf
See also →