Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 752 → Rev 753

/branches/MicroMag3_Nick666/trunc/rc.c
21,12 → 21,7
void rc_sum_init (void)
//############################################################################
{
TCCR1B=(1<<CS11)|(1<<CS10)|(1<<ICES1)|(1<<ICNC1);//|(1 << WGM12); //timer1 prescale 64
 
// PWM
//TCCR1A = (1 << COM1B1) | (1 << WGM11) | (1 << WGM10);
//TCCR1B |= (1 << WGM12);
//OCR1B = 55;
TCCR1B=(1<<CS11)|(1<<CS10)|(1<<ICES1)|(1<<ICNC1); //timer1 prescale 64
TIMSK1 |= _BV(ICIE1);
AdNeutralGier = 0;
48,8 → 43,7
signal = (unsigned int) ICR1 - AltICR;
AltICR = ICR1;
//Syncronisationspause?
// if((signal > (int) Parameter_UserParam2 * 10) && (signal < 8000))
//Syncronisationspause?
if((signal > 1100) && (signal < 8000))
{
if(index >= 4) NewPpmData = 0; // Null bedeutet: Neue Daten
62,9 → 56,6
if((signal > 250) && (signal < 687))
{
signal -= 466;
if (index == 1) signal -= 16;
if (index == 2) signal -= 12;
// Stabiles Signal
if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10;}
76,9 → 67,9
PPM_in[index] = tmp;
}
index++;
if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen
if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen
if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08; // Servosignal an J5 anlegen
//if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen
//if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen
//if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08; // Servosignal an J5 anlegen
}
}
}
/branches/MicroMag3_Nick666/trunc/timer0.c
22,9 → 22,10
SIGNAL (SIG_OVERFLOW0) // 9,8kHz
{
static unsigned char cnt_1ms = 1,cnt = 0;
static uint8_t led_dim, led_duty;
unsigned char pieper_ein = 0;
 
if(!cnt--)
if(!cnt--) // ca. 1 kHz
{
cnt = 10;
cnt_1ms++;
31,7 → 32,18
cnt_1ms %= 2;
if(!cnt_1ms) UpdateMotor = 1;
CountMilliseconds++;
}
// LED-Dimmung Duty-Cycle
if (!led_duty--)
{
led_duty = 4;
led_dim = Poti2 >> 2;
PORTD &= ~(1<<PD4); // J5 auf Low
}
}
if (led_dim) led_dim--;
else PORTD |= (1<<PD4);
 
if(beeptime > 1)
{
74,13 → 86,12
TCCR2A=(1<<COM2A1)|(1<<COM2A0)|3;
TCCR2B=(0<<CS20)|(1<<CS21)|(1<<CS22);
// TIMSK2 |= _BV(TOIE2);
TIMSK2 |= _BV(OCIE2A);
// TIMSK2 |= _BV(TOIE2);
TIMSK2 |= _BV(OCIE2A);
 
TIMSK0 |= _BV(TOIE0);
OCR2A = 10;
TCNT2 = 0;
TCNT2 = 0;
}
 
// -----------------------------------------------------------------------
152,6 → 163,6
// disable PWM at PD7
TCCR2A = 3;
// set PD7 to low
PORTD &= ~(1<<PORTD7);
PORTD &= ~(1<<PD7);
}
}