Rev 440 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 440 | Rev 453 | ||
---|---|---|---|
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; |
5 | volatile unsigned char UpdateMotor = 0; |
6 | volatile unsigned int beeptime = 0; |
- | |
7 | volatile unsigned int cntKompass = 800; |
6 | volatile unsigned int beeptime = 0; |
Line 8... | Line 7... | ||
8 | int ServoValue = 0; |
7 | int ServoValue = 0; |
9 | 8 | ||
10 | enum { |
9 | enum { |
Line 40... | Line 39... | ||
40 | PORTD |= (1<<PD2); |
39 | PORTD |= (1<<PD2); |
41 | } |
40 | } |
42 | else |
41 | else |
43 | PORTD &= ~(1<<PD2); |
42 | PORTD &= ~(1<<PD2); |
Line 44... | Line 43... | ||
44 | 43 | ||
45 | if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) |
- | |
46 | { |
- | |
47 | timer0_MM3(); // Kompass auslesen |
- | |
48 | - | ||
49 | if (!cntKompass--) // Aufruf mit 10 Hz |
- | |
50 | { |
- | |
51 | KompassValue = heading_MM3(); |
- | |
52 | KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
- | |
53 | cntKompass = 980; |
- | |
54 | } |
- | |
55 | } |
44 | if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) timer0_MM3(); // Kompass auslesen |
Line 56... | Line 45... | ||
56 | } |
45 | } |
57 | 46 | ||
Line 80... | Line 69... | ||
80 | 69 | ||
Line 81... | Line 70... | ||
81 | // ----------------------------------------------------------------------- |
70 | // ----------------------------------------------------------------------- |
82 | 71 | ||
83 | unsigned int SetDelay (unsigned int t) |
- | |
84 | { |
72 | unsigned int SetDelay (unsigned int t) |
85 | // TIMSK0 &= ~_BV(TOIE0); |
- | |
86 | return(CountMilliseconds + t + 1); |
73 | { |
Line 87... | Line 74... | ||
87 | // TIMSK0 |= _BV(TOIE0); |
74 | return(CountMilliseconds + t + 1); |
88 | } |
75 | } |
89 | 76 | ||
90 | // ----------------------------------------------------------------------- |
- | |
91 | char CheckDelay(unsigned int t) |
77 | // ----------------------------------------------------------------------- |
92 | { |
- | |
93 | // TIMSK0 &= ~_BV(TOIE0); |
78 | char CheckDelay(unsigned int t) |
Line 94... | Line 79... | ||
94 | return(((t - CountMilliseconds) & 0x8000) >> 9); |
79 | { |
95 | // TIMSK0 |= _BV(TOIE0); |
80 | return(((t - CountMilliseconds) & 0x8000) >> 9); |
96 | } |
81 | } |
97 | 82 | ||
98 | // ----------------------------------------------------------------------- |
83 | // ----------------------------------------------------------------------- |
99 | void Delay_ms(unsigned int w) |
84 | void Delay_ms(unsigned int w) |
100 | { |
85 | { |
Line -... | Line 86... | ||
- | 86 | unsigned int akt; |
|
- | 87 | akt = SetDelay(w); |
|
- | 88 | while (!CheckDelay(akt)); |
|
- | 89 | } |
|
- | 90 | ||
- | 91 | void Delay_ms_Mess(unsigned int w) |
|
- | 92 | { |
|
101 | unsigned int akt; |
93 | unsigned int akt; |
102 | akt = SetDelay(w); |
94 | akt = SetDelay(w); |
103 | while (!CheckDelay(akt)); |
95 | while (!CheckDelay(akt)) ANALOG_ON; |
104 | } |
96 | } |
105 | 97 |