Rev 39 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 39 | Rev 40 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | OCR1A = 0; OCR1B = 0; OCR2 = 0; |
48 | OCR1A = 0; OCR1B = 0; OCR2 = 0; |
49 | PORTC |= ROT; |
49 | PORTC |= ROT; |
50 | Strom--; |
50 | Strom--; |
51 | } |
51 | } |
52 | else |
52 | else |
53 | { |
53 | { |
- | 54 | #ifdef _32KHZ |
|
54 | OCR1A = tmp_pwm; OCR1B = tmp_pwm; OCR2 = tmp_pwm; |
55 | OCR1A = tmp_pwm; OCR1B = tmp_pwm; OCR2 = tmp_pwm; |
- | 56 | #endif |
|
- | 57 | ||
- | 58 | #ifdef _16KHZ |
|
- | 59 | OCR1A = 2 * (int)tmp_pwm; OCR1B = 2 * (int)tmp_pwm; OCR2 = tmp_pwm; |
|
- | 60 | #endif |
|
55 | } |
61 | } |
56 | } |
62 | } |
Line 57... | Line 63... | ||
57 | 63 | ||
58 | //############################################################################ |
64 | //############################################################################ |
59 | // |
65 | // |
60 | void PWM_Init(void) |
66 | void PWM_Init(void) |
61 | //############################################################################ |
67 | //############################################################################ |
62 | { |
68 | { |
63 | PWM_OFF; |
- | |
64 | - | ||
65 | #ifdef _16KHZ |
- | |
66 | TCCR1B = (1 << CS10) | (0 << CS11) | (0 << CS12) | (0 << WGM12) | |
- | |
67 | (0 << WGM13) | (0<< ICES1) | (0 << ICNC1); |
- | |
68 | #endif |
- | |
69 | - | ||
70 | #ifdef _32KHZ |
69 | PWM_OFF; |
71 | TCCR1B = (1 << CS10) | (0 << CS11) | (0 << CS12) | (1 << WGM12) | |
70 | TCCR1B = (1 << CS10) | (0 << CS11) | (0 << CS12) | (1 << WGM12) | |
72 | (0 << WGM13) | (0<< ICES1) | (0 << ICNC1); |
- | |
73 | #endif |
71 | (0 << WGM13) | (0<< ICES1) | (0 << ICNC1); |
Line 74... | Line 72... | ||
74 | } |
72 | } |
75 | 73 | ||
76 | //############################################################################ |
74 | //############################################################################ |
Line 247... | Line 245... | ||
247 | if(!PWM) // Sollwert == 0 |
245 | if(!PWM) // Sollwert == 0 |
248 | { |
246 | { |
249 | MotorAnwerfen = 0; // kein Startversuch |
247 | MotorAnwerfen = 0; // kein Startversuch |
250 | ZeitFuerBerechnungen = 0; |
248 | ZeitFuerBerechnungen = 0; |
251 | // nach 1,5 Sekunden den Motor als gestoppt betrachten |
249 | // nach 1,5 Sekunden den Motor als gestoppt betrachten |
252 | if(CheckDelay(MotorGestopptTimer)) |
250 | if(CheckDelay(DrehzahlMessTimer)) |
253 | { |
251 | { |
254 | DISABLE_SENSE_INT; |
252 | DISABLE_SENSE_INT; |
255 | MotorGestoppt = 1; |
253 | MotorGestoppt = 1; |
256 | STEUER_OFF; |
254 | STEUER_OFF; |
257 | } |
255 | } |
Line 338... | Line 336... | ||
338 | ENABLE_SENSE_INT; |
336 | ENABLE_SENSE_INT; |
339 | MinUpmPulse = SetDelay(100); |
337 | MinUpmPulse = SetDelay(100); |
340 | while(!CheckDelay(MinUpmPulse)); // kurz Synchronisieren |
338 | while(!CheckDelay(MinUpmPulse)); // kurz Synchronisieren |
341 | PWM = 10; |
339 | PWM = 10; |
342 | SetPWM(); |
340 | SetPWM(); |
343 | DrehzahlMessTimer = SetDelay(200); |
341 | MinUpmPulse = SetDelay(200); |
344 | while(!CheckDelay(MinUpmPulse)); // kurz Durchstarten |
342 | while(!CheckDelay(MinUpmPulse)); // kurz Durchstarten |
345 | MinUpmPulse = SetDelay(1000); |
343 | MinUpmPulse = SetDelay(1000); |
346 | altPhase = 7; |
344 | altPhase = 7; |
347 | } |
345 | } |
348 | } |
346 | } |