Subversion Repositories FlightCtrl

Rev

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

Rev 688 Rev 689
Line 32... Line 32...
32
 
32
 
33
        // PPM-signal is connected to the Input Capture Pin (PD6) of timer 1
33
        // PPM-signal is connected to the Input Capture Pin (PD6) of timer 1
34
        DDRD &= ~(1<<DDD6);
34
        DDRD &= ~(1<<DDD6);
Line -... Line 35...
-
 
35
        PORTD |= (1<<PORTD6);
-
 
36
 
-
 
37
        // Channel 5,6,7 is decoded to servo signals at pin PD5 (J3), PD4(J4), PD3(J5)
-
 
38
        // set as output
-
 
39
        DDRD |= (1<<DDD5)|(1<<DDD4)|(1<<DDD3);
-
 
40
        // low level
35
        PORTD |= (1<<PORTD6);
41
        PORTD &= ~((1<<PORTD5)|(1<<PORTD4)|(1<<PORTD3));
Line 36... Line 42...
36
 
42
 
37
        // Timer/Counter1 Control Register A, B, C
43
        // Timer/Counter1 Control Register A, B, C
38
 
44
 
Line 125... Line 131...
125
                if(SenderOkay >= 195)  PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3; // cut off lower 3 bit for nois reduction
131
                if(SenderOkay >= 195)  PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3; // cut off lower 3 bit for nois reduction
126
                else PPM_diff[index] = 0;
132
                else PPM_diff[index] = 0;
127
                PPM_in[index] = tmp; // update channel value
133
                PPM_in[index] = tmp; // update channel value
128
            }
134
            }
129
            index++; // next channel
135
            index++; // next channel
130
            // demux sum signal fpr channels 5 to 7
136
            // demux sum signal for channels 5 to 7 to J3, J4, J5
131
                if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20;  // Servosignal an J3 anlegen
137
                if(index == 5) PORTD |= (1<<PORTD5); else PORTD &= ~(1<<PORTD5);
132
                if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10;  // Servosignal an J4 anlegen
138
                if(index == 6) PORTD |= (1<<PORTD4); else PORTD &= ~(1<<PORTD4);
133
                if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08;  // Servosignal an J5 anlegen
139
                if(index == 7) PORTD |= (1<<PORTD3); else PORTD &= ~(1<<PORTD3);
134
        }
140
        }
135
        }
141
        }
136
}
142
}