cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in ADC1_GetConversionValue() ?

klaasdc
Associate II
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 be

temph = (u16)((u16)(templ >> (u8)6) | (u16)(temph << (u8)8));

(shifting the lower byte in the other direction)

Right?

#adc-alignment-shift
1 REPLY 1
zhangjunhe11
Associate
Posted on July 21, 2012 at 07:45

I found the same problem as you,and I have sent a letter to st.com to submit the bug.