AnsweredAssumed Answered

about s12vr64  AD Temperature

Question asked by 周 周 on Sep 3, 2018

I  want to ask about s12vr64  AD Temperature,  my  init  as follow.but the result of ADvalue isn't   correct.The channel  is   0x41,There was no significant difference at different temperatures.Can you tell me the solution?

void ADC_init(unsigned long BUS_CLK){
// ATD0TEST1 ATD0CTL2
/* Select 8-bit resolution*/
ATDCTL1_SRES =0;
/* Right justify data */
ATDCTL3_DJM = 1; // ATDCTL2
/* One conversion per sequence */
ATDCTL3_S1C = 1;
ATDCTL3_S2C = 0;
ATDCTL3_S4C = 0;
ATDCTL3_S8C = 0;
/* Select sample time 4 ATD clock cycles */
ATDCTL4_SMP = 0;
/*The temperature sensor and bandgap voltage amplifier is enabled.*/
CPMUHTCTL_HTE =1;
/* An internal temperature proportional voltag VeHT can be accessed internally */
CPMUHTCTL_VSEL =0;
/* ATD clock Prescaler */
ATDCTL4_PRS = (unsigned char) ((BUS_CLK/(2*ATD_CLK)) - 1);
}

Outcomes