Rev 1565 | Rev 1643 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1565 | Rev 1638 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | { |
30 | { |
31 | static unsigned char cnt_1ms = 1,cnt = 0; |
31 | static unsigned char cnt_1ms = 1,cnt = 0; |
32 | unsigned char pieper_ein = 0; |
32 | unsigned char pieper_ein = 0; |
33 | if(SendSPI) SendSPI--; |
33 | if(SendSPI) SendSPI--; |
34 | if(SpektrumTimer) SpektrumTimer--; |
34 | if(SpektrumTimer) SpektrumTimer--; |
35 | - | ||
36 | if(!cnt--) |
35 | if(!cnt--) |
37 | { |
36 | { |
38 | cnt = 9; |
37 | cnt = 9; |
39 | cnt_1ms++; |
38 | cnt_1ms++; |
40 | cnt_1ms %= 2; |
39 | cnt_1ms %= 2; |
41 | if(!cnt_1ms) UpdateMotor = 1; |
40 | if(!cnt_1ms) UpdateMotor = 1; |
42 | CountMilliseconds++; |
41 | CountMilliseconds++; |
43 | } |
42 | } |
44 | - | ||
45 | if(beeptime >= 1) |
43 | if(beeptime >= 1) |
46 | { |
44 | { |
47 | beeptime--; |
45 | beeptime--; |
48 | if(beeptime & BeepMuster) |
46 | if(beeptime & BeepMuster) |
49 | { |
47 | { |
50 | pieper_ein = 1; |
48 | pieper_ein = 1; |
51 | } |
49 | } |
52 | else pieper_ein = 0; |
50 | else pieper_ein = 0; |
53 | } |
51 | } |
54 | else |
52 | else |
55 | { |
53 | { |
56 | pieper_ein = 0; |
54 | pieper_ein = 0; |
57 | BeepMuster = 0xffff; |
55 | BeepMuster = 0xffff; |
58 | } |
56 | } |
59 | - | ||
60 | if(pieper_ein) |
57 | if(pieper_ein) |
61 | { |
58 | { |
62 | if(PlatinenVersion == 10) PORTD |= (1<<2); // Speaker an PORTD.2 |
59 | if(PlatinenVersion == 10) PORTD |= (1<<2); // Speaker an PORTD.2 |
63 | else PORTC |= (1<<7); // Speaker an PORTC.7 |
60 | else PORTC |= (1<<7); // Speaker an PORTC.7 |
64 | } |
61 | } |
Line 173... | Line 170... | ||
173 | { |
170 | { |
174 | tim_main = SetDelay(10); |
171 | tim_main = SetDelay(10); |
175 | TCCR0B = CK8; |
172 | TCCR0B = CK8; |
176 | TCCR0A = (1<<COM0A1)|(1<<COM0B1)|3;//fast PWM |
173 | TCCR0A = (1<<COM0A1)|(1<<COM0B1)|3;//fast PWM |
177 | OCR0A = 0; |
174 | OCR0A = 0; |
178 | OCR0B = 120; |
175 | OCR0B = 180; |
179 | TCNT0 = (unsigned char)-TIMER_RELOAD_VALUE; // reload |
176 | TCNT0 = (unsigned char)-TIMER_RELOAD_VALUE; // reload |
180 | //OCR1 = 0x00; |
177 | //OCR1 = 0x00; |
181 | - | ||
182 | TIMSK0 |= _BV(TOIE0); |
178 | TIMSK0 |= _BV(TOIE0); |
183 | } |
179 | } |
Line 184... | Line 180... | ||
184 | 180 |