Radio Control PPM Decoding on Arduino Mega

Hi, I've been using Mem's ServoDecode library from the old forums (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1228137503/0) to decode a radio control PPM input. I've got it working successfully on an Arduino Duemilanove, but I'd like to run it on a Mega instead. I used the Mega version of Mem's code (post 70, http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1228137503/60), but it won't work successfully. I've attached the RC receiver to pin 49 as stated in Mem's post, but I just get completely useless data from the Mega. The code flicks in and out of ready and failsafe mode. If I detach the receiver output from pin 49, I get failsafe mode permanently, so something is sort of working. I've checked the output from the receiver with a scope, and it's fine.

Below is the output from the Mega when it's attached to the radio receiver:

The decoder is NOT_SYNCHED
Cx0= 0  Cx1= 0  Cx2= 0  Cx3= 0  Cx4= 0  Cx5= 0  Cx6= 0  Cx7= 0  Cx8= 0  
The decoder is in Failsafe
Cx0= 29485  Cx1= 1313  Cx2= 2115  Cx3= 1500  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  Cx8= 1500  
Ch1= 2202  Ch2= 2054  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
The decoder is in Failsafe
Cx0= 16436  Cx1= 1674  Cx2= 2054  Cx3= 1500  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  Cx8= 1500  
Ch1= 1837  Ch2= 2054  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
Ch1= 1523  Ch2= 2057  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
Ch1= 2149  Ch2= 1992  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
Ch1= 1628  Ch2= 1992  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
Ch1= 876  Ch2= 2023  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
The decoder is READY
Cx0= 16259  Cx1= 1496  Cx2= 2023  Cx3= 1500  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  Cx8= 1500  
Ch1= 2116  Ch2= 1965  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
Ch1= 1418  Ch2= 1965  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
Ch1= 842  Ch2= 1989  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
Ch1= 1740  Ch2= 1989  Ch3= 1500  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  Ch8= 1500  
The decoder is in Failsafe
Cx0= 20134  Cx1= 1211  Cx2= 1936  Cx3= 1500  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  Cx8= 1500

Moving the controls on the radio transmitter has absolutely no effect on the outputs printed over serial.

If anyone has any ideas on how to get some useful data from the receiver, I'd really appreciate it.

Thanks!

I've created a simple library to read PPM signal from Reciever...

is avaliable from https://github.com/kiuz/PPM-Signal-Reader-ARDUINO a GNUv2 License

Thankyou for your reply, sorry for the delay in getting back to you. Thanks for pointing me to your library, I'm looking forward to giving it a go :) I've downloaded it, but it won't compile as it needs "Statistics.h". I can't find that anywhere, if you could point me to where you got it from that'd be great. :)