I am using the ATTiny417. It is new to me. I have tried may examples to read the ADC but it always reads 0x03ff or 1032(same as 0x03ff). I have tried to break it down to it simplest form. I am using PA3. I have a 10K resistor in series with a 10K thermistor.
int main(void){ //initialize ADC0 PORTA_pin_set_isc(PIN3_bm,PORT_ISC_INPUT_DISABLE_gc); //Disable digital input buffer PORTA_set_pin_pull_mode(PIN3_bm, PORT_PULL_OFF); ADC0.CTRLC = ADC_PRESC_DIV4_gc /* CLK_PER divided by 4 */ | ADC_REFSEL_INTREF_gc /* Internal reference */ | 0 << ADC_SAMPCAP_bp; /* Sample Capacitance Selection: disabled */ ADC0.MUXPOS = ADC_MUXPOS_AIN3_gc; /* ADC input pin 3 */ ADC0.CTRLA = 1 << ADC_ENABLE_bp /* ADC Enable: enabled */ | 0 << ADC_FREERUN_bp /* ADC Freerun mode: disabled */ | ADC_RESSEL_10BIT_gc /* 10-bit mode */ | 0 << ADC_RUNSTBY_bp; /* Run standby mode: disabled */ InitializeClock(); Initialize10mSTimer(PFREQ); InitializeIO(); sei(); //enable global int while (1){ //doOff(); ADC_Result = ADC_0_get_conversion(3); } }
>