Rsdio's RC5 breakdown
From DP
Taken from the forum.
I've been referencing San Bergmans' Philips RC-5 Protocol.
First of all, San notes that "half a bit time is elapsed before the receiver will notice the real start of the message." ... and coincidentally, the IRToy protocol forces you to start with a pulse, too, so the first blank is not included. Keep that in mind.
| description | data content |
|---|---|
| RC-5: | 11000101110101 |
| corresponds to: | S1=1 S2=1 T=0 Address=00101=5 Command=110101=0x35=53 |
| Expressed as RC5 pairs: (pulse-blank or blank-pulse) | (implicit blank)-pulse; blank-pulse; pulse-blank; pulse-blank; pulse-blank; blank-pulse; pulse-blank; blank-pulse; blank-pulse; blank-pulse; pulse-blank; blank-pulse; pulse-blank; blank-pulse |
| Then combined into alternating pulse and blank sections (in this notation, -1 is 889µs and -2 is 1778µs) | pulse-1 blank-1 pulse-2 blank-1 pulse-1 blank-1 pulse-1 blank-2 pulse-2 blank-2 pulse-1 blank-1 pulse-1 blank-1 pulse-2 blank-2 pulse-2 blank-2 pulse-1 |
| Then as IRToy: | 889 889 1778 889 889 889 889 1778 1778 1778 889 889 889 889 1778 1778 1778 1778 889 |
| ... all that to say: | Address:5 Command:53 |
| description | data content |
|---|---|
| given: | 889 889 889 889 1778 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 1778 889 1398077 |
| Using the notation from above (1=889µs, 2=1778µs), that's: | (implicit blank) pulse-1 blank-1 pulse-1 blank-1 pulse-2 blank-1 pulse-1 blank-1 pulse-1 blank-1 pulse-1 blank-1 pulse-1 blank-1 pulse-1 blank-1 pulse-1 blank-1 pulse-1 blank-1 pulse-1 blank-1 pulse-1 blank-2 pulse-1 |
| ... back into RC-5 pairs: | (implicit blank)-pulse; blank-pulse; blank-pulse; pulse-blank; pulse-blank; pulse-blank; pulse-blank; pulse-blank; pulse-blank; pulse-blank; pulse-blank; pulse-blank; pulse-blank; blank-pulse |
| or: | 11100000000001 |
| in RC-5: | S1=1 S2=1 T=1 Address=00000=0 Command=000001=1 |
For other protocols, the conversion can be even trickier, because there are more than two timing lengths, but times may not be constant, and start pulses can be much longer than bits.
