Subversion Repositories FlightCtrl

Rev

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

Rev 757 Rev 761
Line 13... Line 13...
13
#include <avr/interrupt.h>
13
#include <avr/interrupt.h>
Line 14... Line 14...
14
 
14
 
15
#include "rc.h"
15
#include "rc.h"
Line 16... Line 16...
16
#include "main.h"
16
#include "main.h"
17
 
17
 
18
volatile int16_t PPM_in[11];
18
volatile int16_t PPM_in[15]; //PPM24 supports 12 channels per frame
19
volatile int16_t PPM_diff[11];
19
volatile int16_t PPM_diff[15];
Line 20... Line 20...
20
volatile uint8_t NewPpmData = 1;
20
volatile uint8_t NewPpmData = 1;
21
volatile uint8_t SenderOkay = 0;
21
volatile uint8_t SenderOkay = 0;
Line 75... Line 75...
75
 
75
 
76
 
76
 
77
/********************************************************************/
77
/********************************************************************/
-
 
78
/*         Every time a positive edge is detected at PD6            */
-
 
79
/********************************************************************/
-
 
80
/*                               t-Frame
-
 
81
       <----------------------------------------------------------------------->
-
 
82
         ____   ______   _____   ________                ______    sync gap      ____
-
 
83
        |    | |      | |     | |        |              |      |                |
-
 
84
        |    | |      | |     | |        |              |      |                |
-
 
85
     ___|    |_|      |_|     |_|        |_.............|      |________________|
78
/*         Every time a positive edge is detected at PD6            */
86
        <-----><-------><------><-------->              <------>                <---
79
/********************************************************************/
87
          t0       t1      t2       t4                     tn                     t0
80
/*
88
 
81
The PPM-Frame length is 22.5 ms.
89
The PPM-Frame length is 22.5 ms.
82
Channel high pulse width range is 0.7 ms to 1.7 ms completed by an 0.3 ms low pulse.
90
Channel high pulse width range is 0.7 ms to 1.7 ms completed by an 0.3 ms low pulse.
83
The mininimum time delay of two events coding a channel is ( 0.7 + 0.3) ms = 1 ms.
91
The mininimum time delay of two events coding a channel is ( 0.7 + 0.3) ms = 1 ms.
Line 110... Line 118...
110
                // synchronize channel index
118
                // synchronize channel index
111
                index = 1;
119
                index = 1;
112
        }
120
        }
113
        else // within the PPM frame
121
        else // within the PPM frame
114
        {
122
        {
115
        if(index < 10) // channel limit is 9 because of the frame length of 22.5 ms
123
        if(index < 14) // PPM24 supports 12 channels
116
        {
124
        {
117
                        // check for valid signal length (0.8 ms < signal < 2.1984 ms)
125
                        // check for valid signal length (0.8 ms < signal < 2.1984 ms)
118
                        // signal range is from 1.0ms/3.2us = 312 to 2.0ms/3.2us = 625
126
                        // signal range is from 1.0ms/3.2us = 312 to 2.0ms/3.2us = 625
119
            if((signal > 250) && (signal < 687))
127
            if((signal > 250) && (signal < 687))
120
            {
128
            {