ADC readout

From Nuclear Physics Group Documentation Pages
Revision as of 15:55, 20 January 2010 by Maurik (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

ADC Readout

This ADC is a bit "funny", it does not quite work as you'd expect and the supplied routines are wicked slow. The details for how this is done properly are in the EP9302 manual, which is difficult to find and harder to decode.

ADC internal working

The ADC is a single ADC with an analog multiplexer to make more than one channel. On the 7250/7260 boards some of the inputs are used internally so cannot be used for measurement.

Because this is a "successive approximation" ADC, the conversion time depends on the input voltage. To make the average conversion time the shortest possible it uses Vref/2 (and not Gnd=0) as it's zero value, and then has the 0 to Vref/2 and Vref/2 to Vref offset. A calibration curve thus has one slope (ideally) and two intercepts.

Another issue with reading this ADC is that you will not get accurate results if you read the ADC port at high speed. You thus need a wait in the loop. Since there is no accurate enough timer, you need to indeed waste CPU cycles in order to read the ADC at a maximum rate. The maximum rate I found works is around 700 Hz.

ADC readout code

The readout code I cooked up is attached. You supply your own calibration slope and intercepts 1 and 2. There is also some code to read the EEPROM calibration values, but these are not really used.

You can supply the ADC_EP9301_Conversion_Wait_Time (around 4000) to fine tune the wait time.