darksidelemm / RS41HUP

RS41HUP - Firmware for Vaisala's RS41 for Amateur Radio use
GNU General Public License v2.0
21 stars 9 forks source link

Nice to have / Internal ADC reference for direct powered trackers #4

Open zanco opened 3 years ago

zanco commented 3 years ago

Hi Powering the RS41 directly to V_MCU there is no voltage (battery) measurement anymore. I wired the V_MCU by 22 K to the old ADC(0) input (pin 15 on the STM32F100 )

Now it does read always the same voltage because I assume the V_MCU is the reference so the value is always constant.

Is there a way to set the reference to the internal 1.2 V reference ? I think is has something to do with ADC 17 which I think if I read right is the Vreference but have no clue how to read that value.

Tried something like this:

reference = ADCVal[17]; voltage = ADCVal[0] * 1200 / reference;

( I did int reference; right after int voltage; )

ADCVakl[17] gives 21: warning: array subscript is above array bounds [-Warray-bounds]

So I am doing something (or a lot) wrong)

Is it easy to fix the reference for the voltage to internal please ?

Thanks