Subversion Repositories FlightCtrl

Rev

Rev 438 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 438 Rev 466
Line 1... Line 1...
1
#include "main.h"
1
#include "main.h"
Line 2... Line 2...
2
 
2
 
3
volatile unsigned int CountMilliseconds = 0;
3
volatile unsigned int CountMilliseconds = 0;
4
volatile static unsigned int tim_main;
4
volatile static unsigned int tim_main;
5
volatile unsigned char UpdateMotor = 0;
-
 
6
volatile unsigned int cntKompass = 0;
5
volatile unsigned char UpdateMotor = 0;
7
volatile unsigned int beeptime = 0;
6
volatile unsigned int beeptime = 0;
8
unsigned int BeepMuster = 0xffff;
7
unsigned int BeepMuster = 0xffff;
Line 9... Line 8...
9
int ServoValue = 0;
8
int ServoValue = 0;
Line 18... Line 17...
18
  T0_FALLING_EDGE  = 6,
17
  T0_FALLING_EDGE  = 6,
19
  T0_RISING_EDGE   = 7
18
  T0_RISING_EDGE   = 7
20
};
19
};
Line 21... Line 20...
21
 
20
 
22
 
21
 
23
SIGNAL (SIG_OVERFLOW0)    // 8kHz
22
SIGNAL (SIG_OVERFLOW0)    // 9,8kHz
24
{
23
{
25
    static unsigned char cnt_1ms = 1,cnt = 0;
24
    static unsigned char cnt_1ms = 1,cnt = 0;
Line 26... Line 25...
26
    unsigned char pieper_ein = 0;
25
    unsigned char pieper_ein = 0;
27
//    TCNT0 -= 250;//TIMER_RELOAD_VALUE;
26
//    TCNT0 -= 250;//TIMER_RELOAD_VALUE;
28
 
27
 
29
   if(!cnt--)
28
   if(!cnt--)
30
    {
29
    {
31
     cnt = 9;
30
     cnt = 10;
32
     cnt_1ms++;
31
     cnt_1ms++;
33
     cnt_1ms %= 2;
32
     cnt_1ms %= 2;
Line 60... Line 59...
60
        {
59
        {
61
         if(PlatinenVersion == 10) PORTD &= ~(1<<2);
60
         if(PlatinenVersion == 10) PORTD &= ~(1<<2);
62
         else                      PORTC &= ~(1<<7);
61
         else                      PORTC &= ~(1<<7);
63
        }
62
        }
Line 64... Line 63...
64
 
63
 
65
        if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV)
-
 
66
        {
-
 
67
                timer0_MM3();           // Kompass auslesen
-
 
68
 
-
 
69
                if (!cntKompass--)              // Aufruf mit 10 Hz
-
 
70
                {
-
 
71
                        KompassValue = heading_MM3();
-
 
72
                        KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
-
 
73
                        cntKompass = 980;
-
 
74
                }
-
 
75
        }
64
        if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) timer0_MM3();         // Kompass auslesen
Line 76... Line 65...
76
}
65
}
77
 
66