Table of Contents
Introduction
Analog I/O Wildcard Hardware
Connecting To Mosaic Controller
Selecting the Wildcard Address
Selecting the Reference Voltage
Analog I/O Wildcard Field Header
Software
Overview of the Software Device Driver Functions
Initializing the Analog I/O Software Drivers
Using the DAC Drivers
Using the A/D Drivers
Installing the Analog I/O Wildcard Driver Software
Using the Driver Code with C
Using the Driver Code with Forth
Glossary
Overview of Glossary Notation
Glossary Quick Reference
Glossary Entries
Hardware Schematics (pdf, 38.3KB)
|
Analog I/O Wildcard User Guide
<< Previous | Next>>
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_DAC as shown in Listings 1-1 and 1-2.
Listing 1-1 C Code Listing for outputing 2.000 votls to Channel 0 on Module 0.
#include <\mosaic\allqed.h>
| // include all qed utilities |
#include "library.c"
| // be sure to include kernel ext |
#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, 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.
Listing 1-3 C Code Listing for using
Delay_Update_DAC12 and Update_DAC12.
#include <\mosaic\allqed.h>
| // include all qed utilities |
#include "library.c"
| // be sure to include kernel ext |
#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 |
; |
<< Previous | Next>>
|