This AN shows a good usage of the input capture function of the timer. You can use the AN to decode other formats as well.
Download source code in an120.zip