Subversion Repositories BL-Ctrl

Rev

Rev 29 | Rev 34 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29 Rev 31
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 
-
 
55
        OCR1A =  tmp_pwm; OCR1B =  tmp_pwm; OCR2  = tmp_pwm;
54
        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 
-
 
61
        }
55
        }
62
}
56
}
Line 63... Line 57...
63
 
57
 
64
//############################################################################
58
//############################################################################
65
//
59
//
66
void PWM_Init(void)
60
void PWM_Init(void)
67
//############################################################################
61
//############################################################################
68
{
62
{
-
 
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
 
69
    PWM_OFF;
70
#ifdef _32KHZ
70
    TCCR1B = (1 << CS10) | (0 << CS11) | (0 << CS12) | (1 << WGM12) |
71
        TCCR1B = (1 << CS10) | (0 << CS11) | (0 << CS12) | (1 << WGM12) |
-
 
72
             (0 << WGM13) | (0<< ICES1) | (0 << ICNC1);
71
             (0 << WGM13) | (0<< ICES1) | (0 << ICNC1);
73
#endif    
Line 72... Line 74...
72
}
74
}
73
 
75
 
74
//############################################################################
76
//############################################################################
Line 305... Line 307...
305
                if(TEST_SCHUB)
307
                if(TEST_SCHUB)
306
                    {
308
                    {
307
                    switch(test)
309
                    switch(test)
308
                        {
310
                        {
309
                        case 0: PWM = 50; test++; break;
311
                        case 0: PWM = 50; test++; break;
310
                        case 1: PWM = 130; test++; break;
312
                        case 1: PWM = 60; test++; break;
311
                        case 2: PWM = 60;  test++; break;
313
                        case 2: PWM = 128;  test++; break;
312
                        case 3: PWM = 140; test++; break;
314
                        case 3: PWM = 200; test++; break;
313
                        case 4: PWM = 150; test = 0; break;
315
                        case 4: PWM = 255; test = 0; break;
314
                        default: test = 0;
316
                        default: test = 0;
315
                        }
317
                        }
316
                    }
318
                    }
317
                }
319
                }
318
            // Motor Stehen geblieben
320
            // Motor Stehen geblieben