Diamond Systems DS-MPE-DAQ0804 User manual

Type
User manual
Universal Driver Software User Manual
DS-MPE-DAQ0804
PCIe Minicard Data Acquisition Module
For Version 7.0.0 and later
Revision A.0 May 2015
Revision
Date
Comment
A.0
5/13/2015
Initial release
Copyright 2015
FOR TECHNICAL SUPPORT Diamond Systems Corporation
PLEASE CONTACT: 555 Ellis Street
Mountain View, CA 94043 USA
support@diamondsystems.com Tel 1-650-810-2500
Fax 1-650-810-2525
www.diamondsystems.com
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 2
CONTENTS
1. Introduction ...................................................................................................................................................... 4
2. Hardware Overview .......................................................................................................................................... 5
2.1 Description .................................................................................................................................................... 5
2.2 Specifications ................................................................................................................................................ 5
3. General programming guidelines ................................................................................................................... 6
3.1 Initialization and Exit Function Calls ............................................................................................................. 6
3.2 Error Handling ............................................................................................................................................... 7
4. Universal Driver API Description .................................................................................................................... 8
4.1 DAQ0804ADSetSettings ............................................................................................................................... 8
4.2 DAQ0804ADSetTiming ................................................................................................................................. 9
4.3 DAQ0804ADSetChannelRange .................................................................................................................. 10
4.4 DAQ0804ADSetChannel............................................................................................................................. 11
4.5 DAQ0804ADTrigger .................................................................................................................................... 12
4.6 DAQ0804ADConvert ................................................................................................................................... 13
4.7 DAQ0804ADInt ........................................................................................................................................... 14
4.8 DAQ0804ADIntStatus ................................................................................................................................. 15
4.9 DAQ0804ADIntPause ................................................................................................................................. 16
4.10 DAQ0804ADIntResume .............................................................................................................................. 16
4.11 DAQ0804ADIntCancel ................................................................................................................................ 17
4.12 DAQ0804DASetSettings ............................................................................................................................. 17
4.13 DAQ0804DAConvert ................................................................................................................................... 18
4.14 DAQ0804DAConvertScan .......................................................................................................................... 19
4.15 DAQ0804DAFunction .................................................................................................................................. 20
4.16 DAQ0804DAUpdate .................................................................................................................................... 21
4.17 DAQ0804WaveformBufferLoad .................................................................................................................. 22
4.18 DAQ0804WaveformConfig ......................................................................................................................... 23
4.19 DAQ0804WaveformStart ............................................................................................................................ 24
4.20 DAQ0804WaveformPause .......................................................................................................................... 24
4.21 DAQ0804WaveformReset........................................................................................................................... 25
4.22 DAQ0804WaveformInc ............................................................................................................................... 26
4.23 DAQ0804DIOConfig .................................................................................................................................... 26
4.24 DAQ0804DIOConfigAll................................................................................................................................ 27
4.25 DAQ0804DIOOutputByte ............................................................................................................................ 27
4.26 DAQ0804DIOInputByte ............................................................................................................................... 28
4.27 DAQ0804DIOOutputBit ............................................................................................................................... 28
4.28 DAQ0804DIOInputBit .................................................................................................................................. 29
4.29 DAQ0804CounterSetRate .......................................................................................................................... 30
4.30 DAQ0804CounterConfig ............................................................................................................................. 31
4.31 DAQ0804CounterRead ............................................................................................................................... 32
4.32 DAQ0804CounterFunction .......................................................................................................................... 33
4.33 DAQ0804PWMConfig ................................................................................................................................. 34
4.34 DAQ0804PWMStart .................................................................................................................................... 35
4.35 DAQ0804PWMStop .................................................................................................................................... 35
4.36 DAQ0804PWMCommand ........................................................................................................................... 36
4.37 DAQ0804UserInterruptConfig ..................................................................................................................... 37
4.38 DAQ0804UserInterruptRun ......................................................................................................................... 38
4.39 DAQ0804UserInterruptCancel .................................................................................................................... 38
4.40 DAQ0804InitBoard ...................................................................................................................................... 39
4.41 DAQ0804FreeBoard ................................................................................................................................... 39
4.42 DAQ0804LED ............................................................................................................................................. 40
4.43 DAQ0804FIFOStatus .................................................................................................................................. 41
5. Universal Driver Application Description .................................................................................................... 42
5.1 DA Convert .................................................................................................................................................. 42
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 3
5.2 DA Convert Scan ........................................................................................................................................ 42
5.3 DA Waveform .............................................................................................................................................. 42
5.4 DIO .............................................................................................................................................................. 42
5.5 Counter Function ......................................................................................................................................... 42
5.6 Counter Set Rate ........................................................................................................................................ 43
5.7 PWM............................................................................................................................................................ 43
5.8 User Interrupt .............................................................................................................................................. 43
5.9 AD Sample .................................................................................................................................................. 43
5.10 AD Sample Scan ......................................................................................................................................... 43
5.11 AD Trigger ................................................................................................................................................... 43
5.12 AD Interrupt ................................................................................................................................................. 43
5.13 LED ............................................................................................................................................................. 44
6. Universal Driver Application Usage Instructions ....................................................................................... 45
6.1 DA Convert .................................................................................................................................................. 45
6.2 DA Concert Scan ........................................................................................................................................ 46
6.3 DA Waveform .............................................................................................................................................. 47
6.4 DIO .............................................................................................................................................................. 48
6.5 Counter Function ......................................................................................................................................... 49
6.6 Counter Set Rate ........................................................................................................................................ 49
6.7 PWM............................................................................................................................................................ 50
6.8 User Interrupt .............................................................................................................................................. 50
6.9 AD Sample .................................................................................................................................................. 51
6.10 AD Sample Scan ......................................................................................................................................... 51
6.11 AD Trigger ................................................................................................................................................... 52
6.12 AD Interrupt ................................................................................................................................................. 53
6.13 LED ............................................................................................................................................................. 53
7. Common Task Reference .............................................................................................................................. 54
7.1 Data Acquisition Feature Overview ............................................................................................................. 54
7.2 Data Acquisition Software Task Reference ................................................................................................ 57
7.3 Performing D/A Conversion ........................................................................................................................ 65
7.4 Performing D/A Conversion Scan ............................................................................................................... 66
7.5 Performing Digital IO Operations ................................................................................................................ 67
7.6 Performing PWM Operations ...................................................................................................................... 69
7.7 Performing Counter Function Operations ................................................................................................... 70
7.8 Performing Counter Set Rate Operation ..................................................................................................... 71
7.9 Performing User Interrupt Operations ......................................................................................................... 72
7.10 Generating D/A Waveform .......................................................................................................................... 74
7.11 Performing A/D Sample .............................................................................................................................. 76
7.12 Performing A/D Sample Scan ..................................................................................................................... 77
7.13 Performing A/D Trigger ............................................................................................................................... 78
7.14 Performing A/D interrupts............................................................................................................................ 78
7.15 Performing LED operations ......................................................................................................................... 82
8. Interface connector details ............................................................................................................................ 83
8.1 DS-MPE-DAQ-0804 Digital GPIO Connector J2 ..................................................................................... 83
8.2 DS-MPE-DAQ-0804 Analog GPIO Connector J3 .................................................................................... 83
Appendix: Reference Information ........................................................................................................................ 84
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 4
1. INTRODUCTION
This user manual contains all essential information about the Universal Driver 7.0 DS-MPE-DAQ0804
demo applications, programming guidelines and usage instructions. This manual also includes the
Universal Driver API descriptions with usage examples.
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 5
2. HARDWARE OVERVIEW
2.1 Description
DS-MPE-DAQ0804 is a rugged data acquisition PCIe MiniCard module consisting of both analog and
configurable digital I/O. The module is ideal for add-on data acquisition I/O expansion in embedded and
OEM applications. The PCIe MiniCard offers 8 single ended or four differential 16-bit analog inputs with
an aggregate sample rate of 100KHz maximum, 2048 sample A/D FIFO, four 16-bit analog outputs, and
14 digital I/O lines. The buffered digital I/O lines can be optionally configured as either pulse width
modulators or counter/timers.
Diamond’s Universal Driver 7.0 software provides driver support for all functions. The DS-MPE-DAQ0804
product comes with the PCIe MiniCard data acquisition I/O module, the CK-DAQ0804 cable kit, and a
hardware kit with jumpers and screws.
2.2 Specifications
8 single ended / 4 differential 16-bit analog inputs
100KHz maximum aggregate sample rate
2048 sample A/D FIFO with programmable threshold
4 analog input ranges: +/-10V, +/-5V, 0-10V, 0-5V
4 16-bit analog outputs
2 analog output ranges: 0-5V, 0-2.5V
14 digital I/O lines, configurable as PWMs or counter/timers:
o 4 24-bit pulse width modulators
o 8 32-bit counter/timers
+3.3VDC input power
Latching connectors for increased ruggedness
Support for Windows 7, XP, and Linux 3.2.x
Universal Driver support for all functions
PCIe MiniCard full size form factor (50.95mm x 30mm)
Operating temperature of -40°C to +85°C
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 6
3. GENERAL PROGRAMMING GUIDELINES
3.1 Initialization and Exit Function Calls
All the demo applications begin with the following functions and should be called in sequence to initialize
the Universal Driver and the board. These functions should be called prior to calling any other DS-MPE-
DAQ0804 board specific functions.
1. dscInit ( ), this function initializes the Universal Driver
2. DAQ0804InitBoard(), this function initializes the DS-MPE-DAQ0804 module
3. DSCGetBoardInfo(), this function collects the board information from the Universal Driver and
returns the boardinfo structure to be used in the board specific functions
At the termination of any demo application, the user should call the dscfree() function to close the file
handles which are opened by the dscInit() function.
These function calls are important in initializing and freeing resources used by the driver. Following is an
example of the framework for an application using the driver:
#include "DSCUD_demo_def.h"
#include “mpedaq0804.h”
ERRPARAMS errorParams; //structure for returning error code and error string
DSCCBP dsccbp; //structure containing PCI board settings
BoardInfo *bi=NULL; //Structure containing board base address
int main()
{
if ( (dscInit ( DSC_VERSION ) != DE_NONE) )
{
dscGetLastError ( &errorParams );
printf ( "dscInit error: %s %s\n", dscGetErrorString (
errorParams.ErrCode ), errorParams.errstring );
return 0;
}
dsccbp.boardtype = DSC_ MPEDAQ0804;
dsccbp.pci_slot = 0;
if (DAQ0804InitBoard ( &dsccbp ) !=DE_NONE)
{
dscGetLastError (&errorParams);
printf ("DAQ0804InitBoard error: %s %s\n",
dscGetErrorString(errorParams.ErrCode), errorParams.errstring );
return 0;
}
bi = DSCGetBoardInfo ( dsccbp.boardnum );
/* Application code goes here */
dscFree ( );
return 0;
}
In the above example, DSC_VERSION, DSC_MPEDAQ0804, and DE_NONE are macros defined in the
included header file, dscud.h file.
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 7
3.2 Error Handling
All the Universal Driver functions provide a basic error handling mechanism that stores the last reported
error in the driver. If the application is not behaving properly, check for the last error by calling the function
dscGetLastError(). This function takes an ERRPARAMS structure pointer as its argument.
Nearly all the available functions in the Universal Driver API return a BYTE value upon completion. This
value represents an error code that will inform the user whether the function call was successful or not.
The user should always check if the result returns a DE_NONE value (signifying that no errors were
reported), as the following code illustrates:
BYTE result;
ERRPARAMS errparams;
if ((result = dscInit(DSC_VERSION)) != DE_NONE)
{
dscGetLastError (&errparams);
fprintf (stderr, "dscInit failed: %s (%s)\n",
dscGetErrorString(result), errparams.errstring);
return result;
}
In this code snippet, the BYTE result of executing a particular driver function (dscInit() in this case) is
stored and checked against the expected return value (DE_NONE). At any point of time, if a function
does not complete successfully, an error code other than DE_NONE will be generated, and the current
API function will be terminated. The function dscGetErrorString() provides a description of the error that
occurred.
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 8
4. UNIVERSAL DRIVER API DESCRIPTION
4.1 DAQ0804ADSetSettings
Function Definition
BYTE DAQ0804ADSetSettings (BoardInfo* bi, DAQ0804ADSETTINGS* settings);
Function Description
This function configures the A/D input range, channel register, and scan settings.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
DAQ0804ADSETTINGS
Structure with following member variables,
Range - 0-1; 0 = 5V, 1 = 10V
Polarity - 0-1; 0 = bipolar, 1 = unipolar
Sedi - 0-1; 0 = single-ended, 1 = differential
Sign - 0-1; in Diff mode only: 0 = even channel is high;
1 = odd channel is high
Lowch - low channel, 0-7 for SE mode or 0-3 for Diff mode
Highch - high channel, 0-7 for SE mode or 0-3 for Diff mode
ADClock - 0-3: 0 = command bit ADSTART = 1; 1 = falling edge
of DIO bit 19; 2 = rising edge of output of counter 0;
3 = rising edge of output of counter 1
ScanEnable - 0 = disable, 1 = enable scan mode
ScanInterval - 0 = 10us, 1 = 12.5us, 2 = 20us, 3 = programmable;
used only if ScanEnable = 1
ProgInt - 100-255, used only if ScanInterval = 3; interval is this
value times 100ns
Return Value
Error code or 0
Usage Example
To configure channel zero in 0-5v with single ended and scan disabled,
DAQ0804ADSETTINGS dscadsettings;
dscadsettings.Polarity = 1;
dscadsettings.Range = 0;
dscadsettings.Sedi = 0;
dscadsettings.Highch = 0;
dscadsettings.Lowch = 0;
dscadsettings.ADClock = 0;
dscadsettings.ScanEnable = 0;
DAQ0804ADSetSettings (bi, &dscadsettings);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 9
4.2 DAQ0804ADSetTiming
Function Definition
BYTE DAQ0804ADSetTiming (BoardInfo* bi, DAQ0804ADSETTINGS* settings);
Function Description
This function configures the A/D clock source and scan settings.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
DAQ0804ADSETTINGS
Structure with following member variables,
Range - 0-1; 0 = 5V, 1 = 10V
Polarity - 0-1; 0 = bipolar, 1 = unipolar
Sedi - 0-1; 0 = single-ended, 1 = differential
Sign - 0-1; in Diff mode only: 0 = even channel is high;
1 = odd channel is high
Lowch - low channel, 0-7 for SE mode or 0-3 for Diff mode
Highch - high channel, 0-7 for SE mode or 0-3 for Diff mode
ADClock - 0-3: 0 = command bit ADSTART = 1; 1 = falling edge
of DIO bit 19; 2 = rising edge of output of counter 0;
3 = rising edge of output of counter 1
ScanEnable - 0 = disable, 1 = enable scan mode
ScanInterval - 0 = 10us, 1 = 12.5us, 2 = 20us, 3 = programmable;
used only if ScanEnable = 1
ProgInt - 100-255, used only if ScanInterval = 3; interval is this
value times 100ns
Return Value
Error code or 0.
Usage Example
To configure channels 0-7 in 0-5v with single ended, and programmable scan interval 100, or 10usec:
DAQ0804ADSETTINGS dscadsettings;
dscadsettings.Polarity = 1;
dscadsettings.Range = 0;
dscadsettings.Sedi = 0;
dscadsettings.Highch = 0;
dscadsettings.Lowch = 0;
dscadsettings.ADClock = 0;
dscadsettings, ScanInterval = 3;
dscadsettings; ProgInt = 100;
DAQ0804ADSetTiming (bi, &dscadsettings);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 10
4.3 DAQ0804ADSetChannelRange
Function Definition
BYTE DAQ0804ADSetChannelRange (BoardInfo* bi, DAQ0804ADSETTINGS* settings);
Function Description
This function configures the A/D input range. All other settings remain the same. The user is expected to
know whether the board is set for a single-ended or differential mode and the odd/sign is set for
differential channel polarity.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
DAQ0804ADSETTINGS
Structure with following member variables,
Range - 0-1; 0 = 5V, 1 = 10V
Polarity - 0-1; 0 = bipolar, 1 = unipolar
Sedi - 0-1; 0 = single-ended, 1 = differential
Sign - 0-1; in Diff mode only: 0 = even channel is high;
1 = odd channel is high
Lowch - low channel, 0-7 for SE mode or 0-3 for Diff mode
Highch - high channel, 0-7 for SE mode or 0-3 for Diff mode
ADClock - 0-3: 0 = command bit ADSTART = 1; 1 = falling edge
of DIO bit 19; 2 = rising edge of output of counter 0;
3 = rising edge of output of counter 1
ScanEnable - 0 = disable, 1 = enable scan mode
ScanInterval - 0 = 10us, 1 = 12.5us, 2 = 20us, 3 = programmable;
used only if ScanEnable = 1
ProgInt - 100-255, used only if ScanInterval = 3; interval is this
value times 100ns
Return Value
Error code or 0.
Usage Example
To configure channel 0 to 3 in 0-5v with single ended and scan disabled;
DAQ0804ADSETTINGS dscadsettings;
dscadsettings.Lowch = 0;
dscadsettings.Highch = 3;
DAQ0804ADSetChannelRange (bi, &dscadsettings);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 11
4.4 DAQ0804ADSetChannel
Function Definition
BYTE DAQ0804ADSetChannel (BoardInfo* bi, int Channel);
Function Description
This function configures the A/D circuit for a single channel. All other settings remain the same. The user
is expected to know whether the board is set for single-ended or differential mode and the odd/sign
setting for differential channel polarity. This function is identical to SetRange except that the same
channel is used for the low and high settings, so that the A/D will continuously sample the same channel
on successive A/D conversions.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
Channel
Input channel, 0-7 for SE mode or 0-3 for Diff mode
Return Value
Error code or 0.
Usage Example
To set the channel number to 2,
int channel ;
Channel = 2;
DAQ0804ADSetChannel (bi,Channel);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 12
4.5 DAQ0804ADTrigger
Function Definition
BYTE DAQ0804ADTrigger (BoardInfo* bi, unsigned* Sample);
Function Description
This function executes one A/D conversion or scan using the current board settings. It does not perform
any configuration of the board but rather uses the current settings. If the board is configured for sample
mode (SCANEN = 0), then one A/D conversion will be performed and stored in the sample buffer. If the
board is configured for scan mode (SCANEN = 1), then one scan of all channels between Highch and
Lowch will be performed and all samples will be stored in the sample buffer.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
Sample
pointer to an array of size 8 to hold the return values
Return Value
Error code or 0.
Usage Example
To read samples from 0
th
channel,
unsigned long sample; // sample reading
DAQ0804ADSETTINGS* dscadsettings;
dscadsettings.Polarity = 1;
dscadsettings.Range = 0;
dscadsettings.Sedi = 0;
dscadsettings.Highch = 0;
dscadsettings.Lowch = 0;
dscadsettings.ADClock = 0;
ScanEnable = 0;
DAQ0804ADSetTiming (bi, dscadsettings);
DAQ0804ADTrigger (bi, &sample);
printf (“The samples from channel 0 : 0x%X\n”,sample);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 13
4.6 DAQ0804ADConvert
Function Definition
BYTE DAQ0804ADConvert (BoardInfo* bi, DAQ0804ADSETTINGS* settings, unsigned* Sample);
Function Description
This function configures the A/D input range, channel register, and scan settings as requested by the
user, and then sets the timing to be non-turbo, single-channel (non-scan), and software trigger. Then it
takes a single A/D sample of a single channel, triggers the A/D, and reads back the A/D sample value.
Function Parameters
Name
BoardInfo
DAQ0804ADSETTINGS
Sample
Return Value
Error code or 0.
Usage Example
To read a single sample value from channel 0, by configuring the A/D input range as 0-5v and single
ended,
DAQ0804ADSETTINGS dscadsettings;
unsigned int sample; // sample reading
dscadsettings.Polarity = 1;
dscadsettings.Range = 0;
dscadsettings.Sedi = 0;
dscadsettings.Highch = 0;
dscadsettings.Lowch = 0;
dscadsettings.ADClock = 0;
dscadsettings.ScanEnable = 0;
DAQ0804ADConvert (bi, &dscadsettings, &sample);
printf (“The samples from channel 0 : 0x%X\n”,sample);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 14
4.7 DAQ0804ADInt
Function Definition
BYTE DAQ0804ADInt (BoardInfo* bi, DAQ0804ADINT* DAQ0804adint);
Function Description
This function enables A/D interrupt operation using the current analog input settings. It configures the
FIFO but leaves all other settings alone.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
DAQ0804ADINT
Structure with following member variables,
FIFOEnable - 0 = disable; interrupt occurs after each sample / scan;
1 = enable; interrupt occurs on FIFO threshold flag
FIFOThreshold - 0-2048, indicates level at which FIFO will generate an
interrupt (if FIFOEnable = 1)
Cycle - 0 = one shot operation; 1 = continuous operation
NumConversions - if Cycle = 0 this is the number of samples / scans to
acquire; if Cycle = 1 this is the size of the circular
buffer in samples / scans
ADBuffer - pointer to A/D buffer to hold the samples
Return Value
Error code or 0.
Usage Example
To enable the A/D interrupt operation,
DAQ0804ADINT dscIntSettings;
dscIntSettings.NumConversions = 1000;
dscIntSettings.Cycle = 1;
dscIntSettings.FIFOEnable = 1;
dscIntSettings.FIFOThreshold = 1000;
dscIntSettings.ADBuffer = (SWORD*) malloc (sizeof (SWORD)*
dscIntSettings.NumConversions);
DAQ0804ADInt (bi, &dscIntSettings);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 15
4.8 DAQ0804ADIntStatus
Function Definition
BYTE DAQ0804ADIntStatus (BoardInfo* bi, DAQ0804ADINTSTATUS* intstatus);
Function Description
This function returns the interrupt routine status including running or not running, number of conversions
completed, cycle mode, FIFO status, and FIFO flags.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
DAQ0804ADINTSTATUS
Structure with following member variables,
OpStatus - 0 = not running, 1 = running
NumConversions - Number of conversions since interrupts started
Cycle - 0 = one-shot operation, 1 = continuous operation
FIFODepth - Current FIFO depth pointer
OF, FF, TF, EF - FIFO flags
Return Value
Error code or 0.
Usage Example
To read the interrupt routine status,
DAQ0804ADINTSTATUS intstatus;
DAQ0804ADIntStatus (bi, &intstatus)
printf ("No of A/D conversions completed %d\n",intstatus.NumConversions);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 16
4.9 DAQ0804ADIntPause
Function Definition
BYTE DAQ0804ADIntPause (BoardInfo* bi);
Function Description
This function pauses A/D interrupts by turning off the interrupt enable and stopping the A/D clock. This
holds the A/D channel counter and FIFO at their current positions.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
Return Value
Error code or 0.
Usage Example
To pauses the A/D interrupts by turning off the interrupt enable and stopping the A/D clock,
DAQ0804ADIntPause (bi);
4.10 DAQ0804ADIntResume
Function Definition
BYTE DAQ0804ADIntResume (BoardInfo* bi);
Function Description
This function resumes A/D interrupts from the point at which they were paused.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
Return Value
Error code or 0.
Usage Example
To resumes the A/D interrupts from the point at which they were paused,
DAQ0804ADIntResume (bi);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 17
4.11 DAQ0804ADIntCancel
Function Definition
BYTE DAQ0804ADIntCancel (BoardInfo* bi);
Function Description
This function stops A/D interrupts by turning off the interrupt enable, stopping the A/D clock, and
removing the A/D interrupt handler.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
Return Value
Error code or 0.
Usage Example
To stops A/D interrupts by turning off the interrupt,
DAQ0804ADIntCancel (bi);
4.12 DAQ0804DASetSettings
Function Definition
BYTE DAQ0804DASetSettings (BoardInfo* bi, int Range, int Sim);
Function Description
This function is designed to work with the AD5686R D/A converter. This function sets the D/A output
ranges, the data format, and the update mode.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
Range
0 = 0-2.5V, 1 = 0-5V
Sim
0 = Individual DAC update mode, 1 = simultaneous update mode
Return Value
Error code or 0.
Usage Example
To set the range as 0 5v with simultaneous update mode,
int Range;
int sim;
Range = 1;
Sim = 1;
DAQ0804DASetSettings (bi,Range,sim);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 18
4.13 DAQ0804DAConvert
Function Definition
BYTE DAQ0804DAConvert (BoardInfo* bi, int Channel, unsigned int DACode);
Function Description
This function outputs a value to a single D/A channel. The output range must be previously set with
DAQ0804DASetSettings().
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
Channel
0-3
DACode
0-65535
Return Value
Error code or 0.
Usage Example
To set channel zero with 5V,
Channel = 0;
DACode = 65535;
DAQ0804DAConvert (bi,channel,DACode);
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 19
4.14 DAQ0804DAConvertScan
Function Definition
BYTE DAQ0804DAConvertScan (BoardInfo* bi, int* ChannelSelect, int* DACodes);
Function Description
This function outputs multiple values to multiple D/A channels. The output ranges must be previously set
with DAQ0804DASetSettings().
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
ChannelSelect[4]
Array of 4 flags: 0 = don’t update channel n, 1 = update channel n
DACodes[4]
Array of 4 D/A values, 0-65535; values where ChannelSelect[n] = 0 are
Ignored
Return Value
Error code or 0.
Usage Example
To update channel 0, 1 with dacode 65535, 32768 respectively and not change any other channel,
ChannelSelect = (int*) malloc (sizeof (int) * 4);
DACodes = (unsigned int*) malloc (sizeof (unsigned int) * 4);
ChannelSelect [0] = 1;
DACodes [0] = 65535;
ChannelSelect [1] = 1;
DACodes [1] = 32768;
DAQ0804DAConvertScan (bi,ChannelSelect, DACodes );
DS-MPE-DAQ0804 Universal Driver User Manual A.0 www.diamondsystems.com Page 20
4.15 DAQ0804DAFunction
Function Definition
BYTE DAQ0804DAFunction (BoardInfo* bi, unsigned DAData, int DACommand);
Function Description
This function enables the programmer to control the D/A chip directly to implement commands that are
not supported by other Universal Driver functions.
Function Parameters
Name
Description
BoardInfo
The handle of the board to operate on
DAData
16-bit value in straight binary 0000-FFFF
DACommand
8-bit value in straight binary 0-FF
Return Value
Error code or 0.
Usage Example
To perform D/A convert operation by using DAQ0804DAFunction,
DACode = 65535;
Channel = 2;
DAcommand =0x10 + (1<<channel); //DA update command
DAQ0804DAFunction (bi,DACode,DAcommand);
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60
  • Page 61 61
  • Page 62 62
  • Page 63 63
  • Page 64 64
  • Page 65 65
  • Page 66 66
  • Page 67 67
  • Page 68 68
  • Page 69 69
  • Page 70 70
  • Page 71 71
  • Page 72 72
  • Page 73 73
  • Page 74 74
  • Page 75 75
  • Page 76 76
  • Page 77 77
  • Page 78 78
  • Page 79 79
  • Page 80 80
  • Page 81 81
  • Page 82 82
  • Page 83 83
  • Page 84 84
  • Page 85 85
  • Page 86 86

Diamond Systems DS-MPE-DAQ0804 User manual

Type
User manual

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI