2014-02-13 05:11 AM
Hi all,
I'm using stm32f100c8 with an external oscillator 8MHz to produce a system clock of 24MHz. All the peripherals are on the default division lines.Now the ADC1 which is with the TIM1 on PCLK2 is supposed to read the battery value which reaches 9v.The battery value is an output from a voltage divider, the following picture, the bottom is connected to the ground.2014-02-13 05:53 AM
Hi !
I believe that your problem lies in the choice of the resistors' values. In order to work correctly, the sampling capacitor of the ADC should charge quickly enough. There should be somewhere in one the manuals (device datasheet or STM32F1xx manual) the maximum impedance allowed to ensure a correct conversion value. Here you have used several megohms of resistance to limit the discharge of the battery, but just replacing megohms with kilo-ohms should give accurate results without sacrificing the conversion time. If you really don't want to discharge the battery with the resistor bridge, you could add a P-MOS to switch on the bridge when reading the battery voltage.Have a nice day,Kraal