Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 273 → Rev 272

/FollowMe/analog.h
File deleted
/FollowMe/analog.c
File deleted
/FollowMe/main.c
62,12 → 62,7
#include "led.h"
#include "menu.h"
#include "printf_P.h"
#include "analog.h"
 
#ifdef USE_FOLLOWME
int16_t UBat = 120;
#endif
 
int main (void)
{
// disable interrupts global
80,11 → 75,11
 
// initalize modules
LED_Init();
 
LEDRED_ON;
TIMER0_Init();
USART0_Init();
USART1_Init();
ADC_Init();
// enable interrupts global
sei();
LEDRED_OFF;
126,30 → 121,6
{
USART0_ProcessRxData();
USART0_TransmitTxData();
// restart ADConversion if ready
if(ADReady)
{
DebugOut.Analog[0] = Adc0;
DebugOut.Analog[1] = Adc1;
DebugOut.Analog[2] = Adc2;
DebugOut.Analog[3] = Adc3;
DebugOut.Analog[4] = Adc4;
DebugOut.Analog[5] = Adc5;
DebugOut.Analog[6] = Adc6;
DebugOut.Analog[7] = Adc7;
 
#ifdef USE_FOLLOWME
// AVcc = 5V --> 5V = 1024 counts
// the voltage at the voltage divider reference point is 0.8V less that the UBat
// because of the silicon diode inbetween.
// voltage divider R2=10K, R3=1K
// UAdc4 = R3/(R3+R2)*(UBat-0.8V) = 1k/(1k+10k)*(UBat-0.8V) = (UBat-0.8V)/11
UBat = (3 * UBat + (69 * Adc4) / 128 + 8) / 4;
DebugOut.Analog[8] = UBat;
#endif
ADReady = 0;
ADC_Enable();
}
}
return (1);
}
/FollowMe/makefile
76,7 → 76,7
 
##########################################################################################################
# List C source files here. (C dependencies are automatically generated.)
SRC = main.c uart0.c uart1.c printf_P.c timer0.c menu.c led.c ubx.c analog.c
SRC = main.c uart0.c uart1.c printf_P.c timer0.c menu.c led.c ubx.c
#ssc.c sdc.c fat16.c
 
##########################################################################################################
/FollowMe/uart0.c
58,15 → 58,15
const uint8_t ANALOG_LABEL[32][16] =
{
//1234567890123456
"Analog Ch0 ", //0
"Analog Ch1 ",
"Analog Ch2 ",
"Analog Ch3 ",
"Analog Ch4 ",
"Analog Ch5 ", //5
"Analog Ch6 ",
"Analog Ch7 ",
"UBat ",
"Debug0 ", //0
"Debug1 ",
"Debug2 ",
"Debug3 ",
"Debug4 ",
"Debug5 ", //5
"Debug6 ",
"Debug7 ",
"Debug8 ",
"Debug9 ",
"Debug10 ", //10
"Debug11 ",