/*#######################################################################################
Decodieren eines RC Summen Signals oder Spektrum Empfänger-Satellit
#######################################################################################*/
UCSR1B =(1<<RXEN1); // set asynchronous mode
UCSR1C &= ~(1 << UMSEL11);
UCSR1C &= ~(1 << UMSEL10); // no parity
UCSR1C &= ~(1 << UPM11);
UCSR1C &= ~(1 << UPM10); // 1 stop bit
UCSR1C &= ~(1 << USBS1); // 8-bit
UCSR1B &= ~(1 << UCSZ12);
UCSR1C |=(1 << UCSZ11);
UCSR1C |=(1 << UCSZ10); // flush receive buffer explicit while(UCSR1A &(1<<RXC1)) UDR1; // enable RX-interrupts at the end
UCSR1B |=(1 << RXCIE1); // -- End of USART1 initialisation return; }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // + Copyright (c) Rainer Walther // + RC-routines from original MK rc.c (c) H&I // + Useful infos from Walter: http://www.rcgroups.com/forums/showthread.php?t=714299&page=2 // + only for non-profit use // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // 20080808 rw Modified for Spektrum AR6100 (PPM) // 20080823 rw Add Spektrum satellite receiver on USART1 (644P only) // 20081213 rw Add support for Spektrum DS9 Air-Tx-Module (9 channels) // Replace AR6100-coding with original composit-signal routines // // --- // Entweder Summensignal ODER Spektrum-Receiver anschließen. Nicht beides gleichzeitig betreiben! // Binding is not implemented. Bind with external Receiver. // Servo output J3, J4, J5 not serviced // // Anschuß Spektrum Receiver // Orange: 3V von der FC (keinesfalls an 5V anschließen!) // Schwarz: GND // Grau: RXD1 (Pin 3) auf 10-Pol FC-Stecker // // --- // Satellite-Reciever connected on USART1: // // DX7/DX6i: One data-frame at 115200 baud every 22ms. // DX7se: One data-frame at 115200 baud every 11ms. // byte1: unknown // byte2: unknown // byte3: and byte4: channel data (FLT-Mode) // byte5: and byte6: channel data (Roll) // byte7: and byte8: channel data (Nick) // byte9: and byte10: channel data (Gier) // byte11: and byte12: channel data (Gear Switch) // byte13: and byte14: channel data (Gas) // byte15: and byte16: channel data (AUX2) // // DS9 (9 Channel): One data-frame at 115200 baud every 11ms, alternating frame 1/2 for CH1-7 / CH8-9 // 1st Frame: // byte1: unknown // byte2: unknown // byte3: and byte4: channel data // byte5: and byte6: channel data // byte7: and byte8: channel data // byte9: and byte10: channel data // byte11: and byte12: channel data // byte13: and byte14: channel data // byte15: and byte16: channel data // 2nd Frame: // byte1: unknown // byte2: unknown // byte3: and byte4: channel data // byte5: and byte6: channel data // byte7: and byte8: 0xffff // byte9: and byte10: 0xffff // byte11: and byte12: 0xffff // byte13: and byte14: 0xffff // byte15: and byte16: 0xffff // // Each channel data (16 bit= 2byte, first msb, second lsb) is arranged as: // // Bits: F 0 C3 C2 C1 C0 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 // // 0 means a '0' bit // F: 1 = indicates beginning of 2nd frame for CH8-9 (DS9 only) // C3 to C0 is the channel number. 0 to 9 (4 bit, as assigned in the transmitter) // D9 to D0 is the channel data (10 bit) 0xaa..0x200..0x356 for 100% transmitter-travel // // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++