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
Alternative RC5 receiver
Moderator: Benj
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Alternative RC5 receiver
- Attachments
-
- RC5_simple_V2.fcfx
- (19.64 KiB) Downloaded 289 times
-
- RC5_simple_V2.fcf
- (29.23 KiB) Downloaded 329 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Alternative RC5 receiver
Hi Jan,
Cheers for the post looks like a great project
It looks like the import from v5 to v6 is loosing the timer rollover value in the interrupt properties. I have checked and once you reset the value in the properties the C code being generated seems to be correct. I will see if this is something we can fix for the next release.
Cheers for the post looks like a great project

It looks like the import from v5 to v6 is loosing the timer rollover value in the interrupt properties. I have checked and once you reset the value in the properties the C code being generated seems to be correct. I will see if this is something we can fix for the next release.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel