2012-02-20 03:46 AM
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-shift2012-07-20 10:45 PM
I found the same problem as you,and I have sent a letter to st.com to submit the bug.