Link here

24/7 Data Acquisition Wildcard Glossary

This glossary defines the important constants and C library functions that comprise the 24/7 Data Acquisition Wildcard driver code.

The 24/7 Data Acquisition Wildcard™ is a complete analog front end, offering exceptional 24-bit resolution, excellent stability, and remarkable noise rejection for instrumentation applications. Ideal for high resolution, low frequency measurements and data logging, this analog-to-digital converter (ADC) accepts low level signals directly from transducers, amplifies and conditions them, and converts them with 24 bits of resolution with no missing codes performance.


 
AD24_Multiple

C: int AD24_Multiple ( uint num_sample, xaddr starting_xaddr )
4th: AD24_Multiple ( u/xaddr -- [TRUE] or [TIMEOUT_ERROR] | u = num samples, xaddr = start_xaddr )

Acquires u samples from the 24 bit analog to digital (A/D) converter and stores the samples as sequential 32 bit values starting at the specified xaddr within a timeout period or a timeout flag is returned. The returned flag is either TRUE (0xFFFF) or the timeout flag (0x0009). Calls Pause while waiting for the samples. The timeout period is calculated using the following equation:

equation digital to analog

Init_AD24, Use_Onboard_Ref or Use_External_Ref, and Start_Conversion or Start_Conv_With_Values must be called prior to this routine to initialize, configure, and calibrate the 24/7 Data Acquisition Wildcard.

The maximum number of samples is limited to 8192 because this routine can only store data on a single page. The number of samples is clamped so the routine does not store results past a page boundary. No error flag is returned if an invalid number of samples is specified.

This routine uses an interrupt service routine (ISR) tied to output compare 1 (OC1) to obtain samples from the A/D. The ISR runs at more than twice the frequency specified to Start_Conversion or Start_Conv_With_Values. This is done to eliminate clock variations between the A/D and QED clocks and to guarantee that a sample is not missed even if the ISR is delayed up to 1/2 a sample period or one full ISR period. The following equation is used to calculate the sampling period, the maximum acceptable delay time of the ISR, and the maximum time a routine or task can use the SPI:

sample period equation

The INTERRUPT_LATENCY_DELAY is composed of 200 μs for the time to update the A/D data register with sample values, 10 μs of interrupt latency delay, and 50 μs to read the data ready line when the ISR is entered. The INTERRUPT_LATENCY_DELAY is a constant specified in ticks of TCNTs; ie. usually 2 microsecond counts. The processor's TMSK2 register is read to determine the TCNT period. Do not change the resolution of TCNT during the execution of this routine.

This routine is not re-entrant. If using in a multitasking system, be sure only one task calls this routine or be sure that separate tasks do not use the AD7714 at the same time.

AD24_Multiple takes 1.60 ms to setup the ISR and do the error checking on the number of samples before checking the data ready line.

 
AD24_Sample

C: ulong AD24_Sample ( void )
4th: AD24_Sample ( -- ud | ud = conversion result including error flag)

Acquires and places on the stack a single sample from the 24 bit analog to digital (A/D) converter within a timeout period or a timeout error flag is returned. On success the lower 8 bits of ud are zero; if a timeout occurs the lower 8 bits contain the timeout flag (0x09). The timeout period is calculated using the following equation:

calibration delay analog sample

The timeout period allowed is always great enough to account for the filter settling time (pipeline delay) after a channel is changed. The CalibrationDelay used is computed from the most recent calibration that was done, whether it pertained to the current channel or not.

Init_AD24, Use_Onboard_Ref or Use_External_Ref, and Start_Conversion or Start_Conv_With_Values must be called prior to this routine to initialize, configure, and calibrate the 24/7 Data Acquisition Wildcard.

This routine disables interrupts, then checks the data ready line (/DRDY) to see if a sample is ready. If the sample is ready, gets the sample and restores interrupts. If the data is not ready, re-enables interrupts, then calls Pause before checking the data ready line again. If the sample is not ready before the timeout value, the routine returns a 32 bit value with TIMEOUT_ERROR in the least significant byte to indicate a timeout has occurred. If the data is ready, this routine returns the conversion with 0 stored in the least significant byte. For both 16- and 24-bit resolution results the data is returned in the following 32-bit format:

WWWWWWWW XXXXXXXX YYYYYYYY ZZZZZZZZ

For a 16 bit sample, WWWWWWWW is the most significant byte, XXXXXXXX is the least significant byte, YYYYYYYY is 0, and ZZZZZZZZ is the timeout flag. For a 24 bit sample, WWWWWWWW is the most significant byte, XXXXXXXX is the next significant byte, YYYYYYYY is the least significant byte, and ZZZZZZZZ is the timeout flag.

Do not call this routine from within an interrupt service routine. See Example 3 for an example of periodic use.

This routine is not re-entrant. If using in a multitasking system, be sure only one task calls this routine or be sure that separate tasks do not use the AD7714 at the same time.

AD24_Sample takes 1.18 ms to read the data ready line and will obtain a sample within 1.38 ms. The variation between the two times is due to the 200 μs time when the data ready line is high when the AD7714 is updating its output register. The full execution time of this routine if the data is ready is 1.64 ms. If data is not ready, the maximum execution time is slightly greater than the timeout period. Interrupts are disabled for a maximum of less than 400 microseconds.

 
AD24_Sample_NP

C: ulong AD24_Sample_NP ( void )
4th: AD24_Sample_NP ( -- ud | ud = conversion result including error flag)

Identical to AD24_Sample except does not disable interrupts and does not call Pause. Do not use this routine in an interrupt service. See Example 3 for an example of periodic use.

This routine is not re-entrant. If using in a multitasking system, be sure only one task calls this routine or be sure that separate tasks do not use the AD7714 at the same time.

 
Buffer_Off

C: void Buffer_Off ( void )
4th: Buffer_Off ( -- )

Turns the buffered input off. This is the default state after power ups and resets.

 
Buffer_On

C: void Buffer_On ( void )
4th: Buffer_On ( -- )

Allows high source impedances to be used at the analog field inputs by buffering the input signal through an amplifier. This results in a small DC offset voltage developed across the source impedance but not a gain error since the offset current is fixed at 1 nA. The offset voltage can be calculated using Equation 1. With the buffer on, the input voltage is also limited to the range 50 mV - 3.5 V.

 
Init_AD24

C: int Init_AD24 ( char Wildcard_number )
4th: Init_AD24 ( b -- flag | b = Wildcard number )

Initializes the 24/7 Data Acquisition Wildcard by starting the timeslicer, turning on the SPI, disconnecting the analog field inputs from the analog to digital converter, and resetting the analog to digital converter. Returns a false flag if the Wildcard number is not valid. Valid Wildcards are MODULE0, MODULE1, MODULE2, MODULE3, MODULE4, MODULE5, MODULE6, and MODULE7.

This routine does not lastingly change the SPI settings. The SPI settings are changed before each read or write operation to the analog to digital converter and then restored when the operation is complete. This Wildcard is fully compatible with any routine that uses the SPI as long as that routine gets (using GET) and releases (using RELEASE) the SPI resource variable properly.

 
Read_Digital_IO

C: char Read_Digital_IO ( void )
4th: Read_Digital_IO ( -- nibble )

Reads the 3 digital I/O lines on the 24/7 Data Acquisition Wildcard. The data is returned in the least significant nibble. The least significant bit of the returned byte indicates the status of the data ready line as shown in the following figure. The other three bits are uncommitted.

Bit 3 Bit 2 Bit 1 Bit 0
DIN-3 (Pin 3 of H2) DIN-2 (Pin 6 of H2) DIN-1 (Pin 5 of H2) \DRDY
 
Read_FS_Cal

C: ulong Read_FS_Cal ( void )
4th: Read_FS_Cal ( -- ud | ud = fs cal value including error flag)

Reads the full scale calibration information from the analog to digital converter for the current channel and settings. Start_Conversion must be called before attempting to read the full scale calibration information or invalid calibration information will be returned.

This routine checks the data ready line before reading the calibration coefficient. It checks the data ready line to make sure that a calibration is not occurring. If the converter is in the midst of a calibration sequence, this routine will wait up to 10 sample periods (the delay associated with a Full Self Calibration). If the data ready line does not return low within the delay time, it will return a timeout error (0x09) in the lower 8 bits of the returned 32-bit value, otherwise the lower 8 bits will be zero.

 
Read_Zero_Cal

C: ulong Read_Zero_Cal ( void )
4th: Read_Zero_Cal ( -- ud | ud = zero cal value including error flag)

Reads the zero scale calibration information from the analog to digital converter for the current channel and settings. Start_Conversion must be called before attempting to read the zero calibration information or invalid calibration information will be returned.

This routine checks the data ready line before reading the calibration coefficient. It checks the data ready line to make sure that a calibration is not occurring. If the converter is in the midst of a calibration sequence, this routine will wait up to 10 sample periods (the delay associated with a Full Self Calibration). If the data ready line does not return low within the delay time, it will return a timeout error (0x09) in the lower 8 bits of the returned 32-bit value, otherwise the lower 8 bits will be zero.

 
Reset_AD24

C: void Reset_AD24 ( void )
4th: Reset_AD24 ( -- )

Resets the digital filter, the analog modulator, and the on-chip registers of the analog to digital converter, disconnects all analog field inputs (not including the reference inputs), turns the input buffer off, and stops conversion operations. Start_Conversion or Start_Conv_With_Values must be executed after this routine is called to start another conversion.

 
Software_Reset

C: void Software_Reset ( void )
4th: Software_Reset ( -- )

Resets the serial interface of the analog to digital converter to a known state. This routine does not reset contents of any registers but if the interface was lost, it is advisable to set up all registers again using Start_Conversion or Start_Conv_With_Values. This routine does not disconnect the analog field inputs from the analog to digital converter or turn the buffer off.

 
Start_Conv_With_Values

C: void Start_Conv_With_Values ( ulong fs_cal_val, ulong zero_cal_val, uint freq_int, char gain, char pol, char res, char bo, char fysnc, char ch )
4th: Start_Conv_With_Values ( ud1\ud2\u\b1\b2\b3\b4\b5\b6 -- )

Starts a conversion without a calibration. This routine loads the calibration registers with the specified calibration values and options and starts a conversion. It interrupts the A/D from its current operation, reconfigures it, and commences repetitive conversions. Init_AD24, Use_Onboard_Ref or Use_External_Ref, and Start_Conversion must be called prior to this routine to initialize, configure, and calibrate the 24/7 Data Acquisition Wildcard.

This routine can be used only if a calibration has already been performed on the specified channel with the specified settings and the calibration values have been recorded. This will save up to 10 x sample rate on the first conversion because no calibration is performed. No error checking is done to validate the input parameters to allow for fast execution when switching between channels. The parameters and their allowed values are provided in the following table:

Parameter (4th/C) Description Valid Values
ud1/fs_cal_val Full Scale Calibration Value Value returned by Read_FS_Cal
ud2/zero_cal_val Zero Scale Calibration Value Value returned by Read_Zero_Cal
u/freq_int Frequency Integer 19-4000 The sample rate (as samples/sec) is calculated by dividing 19200 by this number.
b1/gain Sample Gain GAIN_1, GAIN_2, GAIN_4, GAIN_8
GAIN_16, GAIN_32, GAIN_64, GAIN_128
b2/pol Signal Polarity UNIPOLAR, BIPOLAR
b3/res Sample Resolution WORD_16BIT, WORD_24BIT
b4/bo Burnout Current Option BO_ON, BO_OFF
b5/fsync Synchronization Option FSYNC_ON, FSYNC_OFF
b6/ch Channel Number Pseudo-Differential Options:
CH_0_7, CH_1_7, CH_2_7, CH_3_7
CH_4_7, CH_5_7, CH_6_7
Fully-Differential Options:
CH_0_1, CH_2_3, CH_4_5, CH_6_7

AD24_Sample should be called after this routine to fetch conversion results. This routine is not re-entrant. If used in a multitasking system, ensure that only one task calls this routine or that separate tasks do not use the AD7714 at the same time. This routine takes 2.34 ms to start a conversion and 7.00 ms to execute.

 
Start_Conversion

C: int Start_Conversion ( char cal_type, uint freq_int, char gain, char pol, char res, char bo, char ch )
4th: Start_Conversion ( b1\u\b2\b3\b4\b5\b6 -- flag )

Starts a conversion by configuring the specified channel with the specified options. It interrupts the A/D from its current operation, reconfigures it, and commences repetitive conversions. Init_AD24 and Use_Onboard_Ref or Use_External_Ref must be called prior to this routine to initialize the 24/7 Data Acquisition Wildcard. Error checking is done for each option and an error flag is returned if an invalid parameter is used. Note that the flag validates input parameters, not calibration results. The parameters and their allowed values are provided in the following table:

Parameter (4th/C) Description Valid Values
b1/cal_type Calibration Type SELF_CAL ZERO_SELF_CAL
FS_SELF_CAL BACKGND_CAL
ZERO_SYS_CAL FS_SYS_CAL
SYS_OFFSET_CAL
u/freq_int Frequency Integer 19-4000 The sample rate (as samples/sec) is calculated by dividing 19200 by this number.
B2/gain Sample Gain GAIN_1, GAIN_2, GAIN_4, GAIN_8
GAIN_16, GAIN_32, GAIN_64, GAIN_128
b3/pol Signal Polarity UNIPOLAR, BIPOLAR
b4/res Sample Resolution WORD_16BIT, WORD_24BIT
b5/bo Burnout Current Option BO_ON, BO_OFF
b6/ch Channel Number Pseudo-Differential Options:
CH_0_7, CH_1_7, CH_2_7, CH_3_7, CH_4_7, CH_5_7, CH_6_7
Fully-Differential Options:
CH_0_1, CH_2_3, CH_4_5, CH_6_7
Flag Error Flag TRUE= -1 indicates success
INVALID_GAIN = 1
INVALID_FREQ = 2
INVALID_CAL = 3
INVALID_CHANNEL = 4
INVALID_FSYNC = 5
INVALID_BO = 6
INVALID_SIZE = 7
INVALID_POLARITY = 8
TIMEOUT_ERROR = 9

This routine is not re-entrant. If used in a multitasking system, ensure that only one task calls this routine or that separate tasks do not use the AD7714 at the same time. If several calibrations are performed in sequence each must be allowed to run to completion before initiating the next. Because Start_Conversion returns before the calibration is complete, to ensure that a calibration is complete before initiating the next you should call AD24_Sample, Read_FS_Cal, or Read_Zero_Cal in between as those routines wait for sample completion before returning.

This routine takes 3.08 ms to start a conversion and 5.08 ms to execute.

 
Stop_Conversion

C: void Stop_Conversion ( void )
4th: Stop_Conversion ( -- )

Disconnects the 24 bit analog to digital converter from its analog field inputs including the voltage references. Called in Init_AD24 and Reset_AD24. Does not stop the AD7714 from doing repetitive conversions, but does disconnect its inputs.

 
Sync

C: void Sync ( void )
4th: Sync ( -- )

Resets the modulator and digital filter of the analog to digital converter without affecting any of the setup conditions. This allows you to start gathering samples from the analog input from a known point in time (once the routine is executed). 3 sample periods must elapse before the next valid sample is available. See pages 26 and 27 of the data sheet for more information.

 
Use_External_Ref

C: void Use_External_Ref ( void )
4th: Use_External_Ref ( -- )

Connects pins 9 (FDREF+) and 11 (FDREF-) as the 24 bit analog to digital converter's reference and disconnects the on-board reference voltage. The external reference may be derived from any external source, or from the WildCard's reference output (pins 7 for REF+ and 13 for REF-), so long as the reference voltage magnitued (REF+ ? REF-) is in the range of +1V to +2.5V and lies within the common mode input range of the A/D (0-5V with the buffer off, 0-3.5V with the buffer on).

This routine must be used after Init_AD24 or Stop_Conversion and before Start_Conversion or Start_Conv_With_Values to restore the reference connection before a calibration is done.

 
Use_Onboard_Ref

C: void Use_Onboard_Ref ( void )
4th: Use_Onboard_Ref ( -- )

Connects the on-board 2.5 volt reference to the 24 bit analog to digital converter and disconnects the external reference voltage. Must be used after Init_AD24 or Stop_Conversion and before Start_Conversion or Start_Conv_With_Values to restore the reference connection before a calibration is done.

 
This page is about: 24-bit Analog to Digital Conversion, C Library Function Glossary – This glossary defines important constants and C library functions that comprise 24/7 Data Acquisition Wildcard driver code. The 24/7 Data Acquisition Wildcard™ is complete analog front end, offering exceptional 24 bit resolution, excellent stability, and …
 
 
Navigation