Rev 1320 | Rev 1377 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1320 | Rev 1322 | ||
---|---|---|---|
Line 181... | Line 181... | ||
181 | // C3 to C0 is the channel number. 0 to 9 (4 bit, as assigned in the transmitter) |
181 | // C3 to C0 is the channel number. 0 to 9 (4 bit, as assigned in the transmitter) |
182 | // D9 to D0 is the channel data (10 bit) 0xaa..0x200..0x356 for 100% transmitter-travel |
182 | // D9 to D0 is the channel data (10 bit) 0xaa..0x200..0x356 for 100% transmitter-travel |
183 | // |
183 | // |
184 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
184 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line 185... | Line 185... | ||
185 | 185 | ||
186 | #define MAX_FRAMEGAP 56 // 7ms |
186 | #define MIN_FRAMEGAP 68 // 7ms |
Line 187... | Line 187... | ||
187 | #define MAX_BYTEGAP 3 // 375us |
187 | #define MAX_BYTEGAP 3 // 310us |
188 | 188 | ||
189 | //############################################################################ |
189 | //############################################################################ |
190 | //Diese Routine startet und inizialisiert den USART1 für seriellen Spektrum satellite reciever |
190 | //Diese Routine startet und inizialisiert den USART1 für seriellen Spektrum satellite reciever |
Line 199... | Line 199... | ||
199 | c = UDR1; // get data byte |
199 | c = UDR1; // get data byte |
200 | if(ReSync == 1) |
200 | if(ReSync == 1) |
201 | { |
201 | { |
202 | // wait for beginning of new frame |
202 | // wait for beginning of new frame |
203 | ReSync = 0; |
203 | ReSync = 0; |
204 | SpektrumTimer = MAX_FRAMEGAP; |
204 | SpektrumTimer = MIN_FRAMEGAP; |
205 | FrameCnt = 0; |
205 | FrameCnt = 0; |
206 | Sync = 0; |
206 | Sync = 0; |
207 | ByteHigh = 0; |
207 | ByteHigh = 0; |
208 | } |
208 | } |
209 | else |
209 | else |
Line 221... | Line 221... | ||
221 | } |
221 | } |
222 | else |
222 | else |
223 | { |
223 | { |
224 | // Zeichen kam vor Ablauf der 7ms Sync-Pause |
224 | // Zeichen kam vor Ablauf der 7ms Sync-Pause |
225 | // warten auf erstes Sync-Zeichen |
225 | // warten auf erstes Sync-Zeichen |
226 | SpektrumTimer = MAX_FRAMEGAP; |
226 | SpektrumTimer = MIN_FRAMEGAP; |
227 | FrameCnt = 0; |
227 | FrameCnt = 0; |
228 | Sync = 0; |
228 | Sync = 0; |
229 | ByteHigh = 0; |
229 | ByteHigh = 0; |
230 | } |
230 | } |
231 | } |
231 | } |
Line 295... | Line 295... | ||
295 | // hier stimmt was nicht: neu synchronisieren |
295 | // hier stimmt was nicht: neu synchronisieren |
296 | ReSync = 1; |
296 | ReSync = 1; |
297 | FrameCnt = 0; |
297 | FrameCnt = 0; |
298 | Frame2 = 0; |
298 | Frame2 = 0; |
299 | // new frame next, nach fruehestens 7ms erwartet |
299 | // new frame next, nach fruehestens 7ms erwartet |
300 | SpektrumTimer = MAX_FRAMEGAP; |
300 | SpektrumTimer = MIN_FRAMEGAP; |
301 | } |
301 | } |
Line 302... | Line 302... | ||
302 | 302 | ||
303 | // 16 Bytes eingetroffen -> Komplett |
303 | // 16 Bytes eingetroffen -> Komplett |
304 | if(FrameCnt >= 16) |
304 | if(FrameCnt >= 16) |
Line 311... | Line 311... | ||
311 | if(!ReSync) NewPpmData = 0; |
311 | if(!ReSync) NewPpmData = 0; |
312 | } |
312 | } |
313 | FrameCnt = 0; |
313 | FrameCnt = 0; |
314 | Frame2 = 0; |
314 | Frame2 = 0; |
315 | Sync = 0; |
315 | Sync = 0; |
316 | SpektrumTimer = MAX_FRAMEGAP; |
316 | SpektrumTimer = MIN_FRAMEGAP; |
317 | } |
317 | } |
318 | } |
318 | } |
319 | } |
319 | } |