Subversion Repositories FlightCtrl

Rev

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

Rev 1120 Rev 1153
Line 118... Line 118...
118
//Hauptprogramm
118
//Hauptprogramm
119
int main (void)
119
int main (void)
120
//############################################################################
120
//############################################################################
121
{
121
{
122
        unsigned int timer;
122
        unsigned int timer;
123
 
-
 
124
        //unsigned int timer2 = 0;
-
 
125
    DDRB  = 0x00;
123
    DDRB  = 0x00;
126
    PORTB = 0x00;
124
    PORTB = 0x00;
127
    for(timer = 0; timer < 1000; timer++); // verzögern
125
    for(timer = 0; timer < 1000; timer++); // verzögern
128
    if(PINB & 0x01)
126
    if(PINB & 0x01)
129
     {
127
     {
Line 141... Line 139...
141
    PORTC = 0xff; // Pullup SDA
139
    PORTC = 0xff; // Pullup SDA
142
    DDRB  = 0x1B; // LEDs und Druckoffset
140
    DDRB  = 0x1B; // LEDs und Druckoffset
143
    PORTB = 0x01; // LED_Rot
141
    PORTB = 0x01; // LED_Rot
144
    DDRD  = 0x3E; // Speaker & TXD & J3 J4 J5
142
    DDRD  = 0x3E; // Speaker & TXD & J3 J4 J5
145
    DDRD  |=0x80; // J7 -> Servo signal
143
    DDRD  |=0x80; // J7 -> Servo signal
146
        PORTD = 0x77; // LED
144
        PORTD = 0x47; // LED
147
 
-
 
Line 148... Line 145...
148
 
145
 
149
    MCUSR &=~(1<<WDRF);
146
    MCUSR &=~(1<<WDRF);
150
    WDTCSR |= (1<<WDCE)|(1<<WDE);
147
    WDTCSR |= (1<<WDCE)|(1<<WDE);
Line 242... Line 239...
242
        while (1)
239
        while (1)
243
        {
240
        {
Line 244... Line 241...
244
 
241
 
245
                if(UpdateMotor)      // ReglerIntervall
242
                if(UpdateMotor)      // ReglerIntervall
246
            {
-
 
247
                    UpdateMotor=0;
243
            {
-
 
244
//PORTD |= 0x08;
248
//PORTD |= 0x08;
245
                    UpdateMotor=0;
249
            if(WinkelOut.CalcState) CalMk3Mag();
246
            if(WinkelOut.CalcState) CalMk3Mag();
250
            else MotorRegler();
-
 
251
//PORTD &= ~0x08;
247
            else MotorRegler();
252
            SendMotorData();
248
            SendMotorData();
253
            ROT_OFF;
249
            ROT_OFF;
254
            if(PcZugriff) PcZugriff--;
250
            if(PcZugriff) PcZugriff--;
255
             else
251
             else
Line 289... Line 285...
289
                   {
285
                   {
290
                    beeptime = 6000;
286
                    beeptime = 6000;
291
                    BeepMuster = 0x0300;
287
                    BeepMuster = 0x0300;
292
                   }
288
                   }
293
                }
289
                }
294
/*           if(SendVersionToNavi)
-
 
295
              {
-
 
296
               SPI_StartTransmitPacket(SPI_CMD_VERSION);//#
-
 
297
               SendVersionToNavi = 0;
-
 
298
              }
-
 
299
              else  SPI_StartTransmitPacket(SPI_CMD_VALUE);//#
-
 
300
*/
-
 
301
             SPI_StartTransmitPacket();//#
290
             SPI_StartTransmitPacket();
Line 302... Line 291...
302
 
291
 
303
             SendSPI = 4;
292
             SendSPI = 4;
304
                         timer = SetDelay(20);
293
                         timer = SetDelay(20);
305
            }
-
 
306
           //if(UpdateMotor) DebugOut.Analog[26]++;
294
            }
-
 
295
           LED_Update();
307
           LED_Update();
296
//PORTD &= ~0x08;
308
          }
297
          }
309
     if(!SendSPI) { SPI_TransmitByte(); }
298
     if(!SendSPI) { SPI_TransmitByte(); }
310
    }
299
    }
311
 return (1);
300
 return (1);