Rev 276 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 276 | Rev 284 | ||
---|---|---|---|
Line 152... | Line 152... | ||
152 | 152 | ||
153 | #ifdef USE_FOLLOWME |
153 | #ifdef USE_FOLLOWME |
154 | // AVcc = 5V --> 5V = 1024 counts |
154 | // AVcc = 5V --> 5V = 1024 counts |
155 | // the voltage at the voltage divider reference point is 0.8V less that the UBat |
155 | // the voltage at the voltage divider reference point is 0.8V less that the UBat |
156 | // because of the silicon diode inbetween. |
156 | // because of the silicon diode inbetween. |
157 | // voltage divider R2=10K, R3=1K |
- | |
158 | // UAdc4 = R3/(R3+R2)*UBat= 1k/(1k+10k)*UBat = UBat/11 |
157 | // voltage divider R2=10K, R3=3K9 |
159 | // UAdc4 = R3/(R3+R2)*UBat= 3.9k/(3.9k+10k)*UBat = UBat/3.564 |
158 | // UAdc4 = R3/(R3+R2)*UBat= 3.9/(3.9+10)*UBat = UBat/3.564 |
160 | UBat = (3 * UBat + (69 * Adc4) / 128) / 4; |
159 | UBat = (3 * UBat + (64 * Adc4) / 368) / 4; |
161 | DebugOut.Analog[8] = UBat; |
160 | DebugOut.Analog[8] = UBat; |
162 | #endif |
161 | #endif |
163 | ADReady = 0; |
162 | ADReady = 0; |
164 | ADC_Enable(); // restart ad conversion sequence |
163 | ADC_Enable(); // restart ad conversion sequence |