Alternative RC5 receiver
Posted: Sun Nov 24, 2013 1:08 pm
I made an alternative RC5 receiver on one of the PortB selected.
Principal:
1) Detect the period time for 1 bit (about 1900 usec)
2) Synchronise on the level change half way each bit
3) Read input status directly after this half-way pulse
4) Wait 3/4 of a period to start at 2)
5) Repeat for 12 bits with:
Toggle (1 bit), Address (5 bits) and Command (6 bits)
Interrupts used:
1) Timer2 (76800 Hz / 13 usec),
but any other timer fits which measure the 900 usec accurate enough
2) Interrupt On Change (IOC) on portB on any change (positive and negative)
In this version port B0, but all other ports can be used
(change the IOC interrupt and inputs of port B0)
Remark:
1. There are no requirements for the chip oscillator frequency
2. Flowcode V6 version fails due to the fact that the rollover (pr2 register) of Time 2 can not be changed (is fixed to 256 and should be 64)
Have fun
Jan Lichtenbelt
PS. With an additional C-code, the Flowcode V6 version works now also
Principal:
1) Detect the period time for 1 bit (about 1900 usec)
2) Synchronise on the level change half way each bit
3) Read input status directly after this half-way pulse
4) Wait 3/4 of a period to start at 2)
5) Repeat for 12 bits with:
Toggle (1 bit), Address (5 bits) and Command (6 bits)
Interrupts used:
1) Timer2 (76800 Hz / 13 usec),
but any other timer fits which measure the 900 usec accurate enough
2) Interrupt On Change (IOC) on portB on any change (positive and negative)
In this version port B0, but all other ports can be used
(change the IOC interrupt and inputs of port B0)
Remark:
1. There are no requirements for the chip oscillator frequency
2. Flowcode V6 version fails due to the fact that the rollover (pr2 register) of Time 2 can not be changed (is fixed to 256 and should be 64)
Have fun
Jan Lichtenbelt
PS. With an additional C-code, the Flowcode V6 version works now also