Question
Bug in ADC1_GetConversionValue() ?
Posted on February 20, 2012 at 12:46
I was trying to get the ADC working on an STM8S discovery, but left and right alignment setting of the ADC gives different results.
In the file stm8s_adc1.c of the standard firmware library there is:/* Left alignment */
{ /* Read MSB firts*/ temph = ADC1->DRH; /* Then read LSB */ templ = ADC1->DRL; temph = (u16)((u16)(templ << (u8)6) | (u16)(temph << (u8)8)); } I suppose that last line should betemph = (u16)((u16)(templ >> (u8)6) | (u16)(temph << (u8)8));
(shifting the lower byte in the other direction) Right? #adc-alignment-shift