Subversion Repositories Projects

Rev

Rev 274 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 274 Rev 275
Line 148... Line 148...
148
                        #ifdef USE_FOLLOWME
148
                        #ifdef USE_FOLLOWME
149
                        // AVcc = 5V --> 5V = 1024 counts
149
                        // AVcc = 5V --> 5V = 1024 counts
150
                        // the voltage at the voltage divider reference point is 0.8V less that the UBat
150
                        // the voltage at the voltage divider reference point is 0.8V less that the UBat
151
                        // because of the silicon diode inbetween.
151
                        // because of the silicon diode inbetween.
152
                        // voltage divider R2=10K, R3=1K
152
                        // voltage divider R2=10K, R3=1K
153
                        // UAdc4 = R3/(R3+R2)*(UBat-0.8V) = 1k/(1k+10k)*(UBat-0.8V) = (UBat-0.8V)/11
153
                        // UAdc4 = R3/(R3+R2)*UBat= 1k/(1k+10k)*UBat = UBat/11
-
 
154
                        // UAdc4 = R3/(R3+R2)*UBat= 3.9k/(3.9k+10k)*UBat = UBat/3.564
154
                        UBat = (3 * UBat + (69 * Adc4) / 128 + 8) / 4;
155
                        UBat = (3 * UBat + (69 * Adc4) / 128) / 4;
155
                        DebugOut.Analog[8] = UBat;
156
                        DebugOut.Analog[8] = UBat;
156
                        #endif
157
                        #endif
157
                        ADReady = 0;
158
                        ADReady = 0;
158
                        ADC_Enable(); // restart ad conversion sequence
159
                        ADC_Enable(); // restart ad conversion sequence
159
                }
160
                }