#ifndef __AD7719_ADC_H #define __AD7719_ADC_H //----------------------------------------------------------------------------- #include "typedefs.h" #include "application.h" #include "num_conversion.h" //----------------------------------------------------------------------------- // Bit Definitions #define ADC_RDY PD6 #define ADC_RST PD7 #define AD7719_IS_READY() (!(PIND & (1< AUX ADc is used for Temp measurement. // ACH = 011 --> Tempsensor // U/#B = 0 --> bipolar, but i'm not entirely sure if this is correct. // ARN = 1 --> input range is REFIN2 , but when tempsensor is chosen, internal ref is used ... #define AD0CON_INIT 0x8E // 1000.1110 // AD0EN is set // WL is cleared --> 24bit // CH = 00 --> AIN1 , AIN2 used // U/#B = 1 --> unipolar // RN=110 --> input range = +-1.28V --> whatever this means in ratiometric measurements. #define MODE_IDLE 0x01 #define MODE_SINGLE 0x02 #define MODE_CONT 0x03 #define MODE_INTERNAL_ZERO_CAL 0x04 // not tested #define MODE_INTERNAL_FULL_CAL 0x05 // not tested // since the ADC is chopped, one should wait 3 conversions // after the muxer was switched, until the reading is okay. #define READINGS_UNTIL_AD7719_SETTLED 3 void ad7719_init(void); void startconv(U08 continuous); void stopconv(void); U32 read_adc(void); //----------------------------------------------------------------------------- #endif