Subversion Repositories BL-Ctrl

Rev

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

Rev 23 Rev 24
Line 27... Line 27...
27
unsigned char MotorGestoppt = 1;
27
unsigned char MotorGestoppt = 1;
28
unsigned char MaxPWM = MAX_PWM;
28
unsigned char MaxPWM = MAX_PWM;
29
unsigned int  CntKommutierungen = 0;
29
unsigned int  CntKommutierungen = 0;
30
unsigned int  SIO_Drehzahl = 0;
30
unsigned int  SIO_Drehzahl = 0;
31
unsigned char ZeitZumAdWandeln = 1;
31
unsigned char ZeitZumAdWandeln = 1;
32
 
-
 
-
 
32
unsigned char MotorAdresse = 1;
Line 33... Line 33...
33
 
33
 
34
//############################################################################
34
//############################################################################
35
//
35
//
36
void SetPWM(void)
36
void SetPWM(void)
Line 180... Line 180...
180
    PORTC = 0x08;
180
    PORTC = 0x08;
181
    DDRD  = 0xBA;
181
    DDRD  = 0xBA;
182
    PORTD = 0x80;
182
    PORTD = 0x80;
183
    DDRB  = 0x0E;
183
    DDRB  = 0x0E;
184
    PORTB = 0x31;
184
    PORTB = 0x31;
-
 
185
       
-
 
186
#if (MOTORADRESSE == 0)
-
 
187
    PORTB |= (ADR1 + ADR2);   // Pullups für Adresswahl
-
 
188
    if (PINB & ADR1)
-
 
189
         {
-
 
190
           if (PINB & ADR2) MotorAdresse = 1;
-
 
191
            else MotorAdresse = 2;
-
 
192
         }
-
 
193
         else
-
 
194
         {
-
 
195
           if (PINB & ADR2) MotorAdresse = 3;
-
 
196
            else MotorAdresse = 4;
-
 
197
         }
-
 
198
#else
-
 
199
    MotorAdresse  = MOTORADRESSE;
-
 
200
#endif
Line 185... Line 201...
185
   
201
   
186
    UART_Init();
202
    UART_Init();
187
    Timer0_Init();
203
    Timer0_Init();
Line 188... Line 204...
188
    sei ();//Globale Interrupts Einschalten
204
    sei ();//Globale Interrupts Einschalten
189
   
205
   
190
    // Am Blinken erkennt man die richtige Motoradresse
206
    // Am Blinken erkennt man die richtige Motoradresse
191
    for(test=0;test<5;test++)
207
    for(test=0;test<5;test++)
192
        {
208
        {
193
        if(test == MOTORADRESSE) PORTD |= GRUEN;
209
        if(test == MotorAdresse) PORTD |= GRUEN;
194
        Delay_ms(150);
210
        Delay_ms(150);
195
        PORTD &= ~GRUEN;
211
        PORTD &= ~GRUEN;