Poseidon contains the ability to generate hardware interrupts to manage A/D conversions. Interrupt-based A/D conversions are used in several situations.
The Diamond Systems Universal Driver functions dscADSampleInt() and dscADSetSettings() manage all of the required parameters to generate interrupt-based A/D conversions. Below is a checklist to help you configure the function call properly. All parameters are passed in the data structure of type DSCAIOINT for function dscADSampleInt() except for the input range.
On Poseidon, the channel numbers range from 0 to 31. Some channel numbers may not be available, depending on the single-ended/differential configuration mode as explained on page 11. D uring interrupt-based A/D conversions, the channels being sampled must be consecutive in number. To sample only a single channel, set the low channel and high channel to the same channel number. To sample a range of channels, set the low and high channels accordingly.
During interrupt-based A/D conversions, the input voltage range must be the same for all channels. Select the input range from the list of codes found in the Analog Input Ranges and Resolution section of this document. This parameter is set with the function dscADSetSettings() prior to calling dscADSampleInt().
For internal clocking, the on-board 32-bit counter/timer is programmed to the desired sample rate. For external clocking, the signal EXTCLK/DIN3on I/O header CN13, pin 39, controls sampling. Falling edges on this pin generate A/D conversions. The signal is edge sensitive; holding it low generate one conversion.
If internal clocking is selected, provide the desired sample rate in Hz as a floating value. The maximum sample rate is 250,000 per second (maximum A/D operating speed), and the slowest rate is .000024383Hz (100KHz input / 232), or approximately 1 sample every 42,950 seconds (approximately 11.9 hours).
You may choose to allow an external signal on CN13, pin 46, to control the sampling. When the signal is high, sampling occurs, and when it is low, sampling pauses. External gating works with both internal and external clocking. This pin is connected to a 4.7K pull-up resistor.
In one-shot mode, the operation occurs one time and then stops, and the parameter num_conversions determines the number of samples taken. In recycle mode, the operation runs repeatedly until you stop the operation by calling dscCancelOp(). In this case, the parameter num_conversions indicates the size of the memory buffer or array used to store the samples. Once the buffer is filled, the data is stored starting at the beginning again, causing the old data to be overwritten. In this situation, you only have access to the latest number of samples equal to num_conversions, and you must read the data out of the buffer before it is overwritten. The function dscGetStatus() can be used to indicate the current buffer position, which is the location at which the next data value will be stored.