Looking for users with experience using RC5 remote control component

jan.didden
Posts: 59
http://meble-kuchenne.info.pl
Joined: Thu Dec 17, 2020 3:16 pm
Has thanked: 18 times
Been thanked: 12 times

Looking for users with experience using RC5 remote control component

Post by jan.didden »

Hi,

I've been trying to get the RC5 component working, so far no luck.
Using the attached RC5 test program attached.
I am pretty sure (but not absolutely) that the remote I am using generates RC5 codes.
Anyone know of any gotcha! 's I should be aware of?

thanks,

Jan Didden
Linear Audio
Attachments
RC5_Test_jd.fcfx
(20.63 KiB) Downloaded 32 times

jan.didden
Posts: 59
Joined: Thu Dec 17, 2020 3:16 pm
Has thanked: 18 times
Been thanked: 12 times

Re: Looking for users with experience using RC5 remote control component

Post by jan.didden »

Started at square one: make sure that the IR detector actually receives and outputs a signal.
See attached, looks OK, no? RC5. So that's what goes into pin C2 of the setup in the previous post.
But the display only shows three zero's .
Any ideas, anyone?

Jan
Attachments
RC5.PNG
RC5.PNG (1.12 MiB) Viewed 1053 times

mnfisher
Valued Contributor
Posts: 399
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 49 times
Been thanked: 227 times

Re: Looking for users with experience using RC5 remote control component

Post by mnfisher »

Hi Jan,

I had a quick try getting the RC5 component to work (wouldn't compile for Arduino or ESP32 - but 3rd time lucky with a PIC). I couldn't read any remote I tried, and I tried a 'basic' one from an Elegoo kit, several TV remotes etc, so I tried using the Arduino IDE and installed the IRRemote library.

After a bit of 'fiddling' - I got this to work and all the the remotes I had tried seemed to use NEC format commands. Having said which - the wave form from the IR sensor doesn't look like yours above.

Are you sure it's RC5? - the Arduino lib is quite an easy way to test this.

I have a 'OneForAll' remote - which I can try with many different TV encodings and hopefully one will be RC5 (Philips?) - so will have an experiment with that too.

Martin

mnfisher
Valued Contributor
Posts: 399
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 49 times
Been thanked: 227 times

Re: Looking for users with experience using RC5 remote control component

Post by mnfisher »

With the One4All generating a RC5 stream - still no joy... The component doesn't seem to 'see' a signal so CheckRx never returns 1

Martin

mnfisher
Valued Contributor
Posts: 399
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 49 times
Been thanked: 227 times

Re: Looking for users with experience using RC5 remote control component

Post by mnfisher »

So it looked like fun....

I wrote a RC5 receiver. Here running on Arduino Nano but there is nothing that shouldn't transfer to another MCU (I output data to UART - you might want to use LCD?)
rc5 receive.fcfx
(22.08 KiB) Downloaded 32 times
Hopefully it is fairly straightforward to understand - Call ReadIRData when the ir 'pin' level falls to 0 (I haven't allowed for inverted signal but fairly easy to do)
ReadIRData is a simple state machine - with Idle, m1, m0, s1,and s0 (see https://ccspicc.blogspot.com/2016/10/rc ... f1822.html)

The other macro is Time (oops I called it Test) - which times a pulse or a space (and it just uses a delay of 110uS - to do this - I initially used a timer and GetMicroSeconds (but too much floating point maths in there for uS accuracy and also GetRawCount - but it doesnn't seem to need it....). The delay work well...

I haven't added any error handling (there is a provision for it in ReadIRData) and at the moment Main pulls the data fields out of the 16 bits data returned (only 13 bits are used!)

Note - it doesn't use an interrupt for the timer - which means that reading an RC5 code 'blocks' other processing. This may or may not cause an issue, depending on application.

Martin

medelec35
Matrix Staff
Posts: 692
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 242 times
Been thanked: 244 times

Re: Looking for users with experience using RC5 remote control component

Post by medelec35 »

Hello.
The issue is caused by the more modern interrupts working differently to the older devices that have 8bit only timer 0.
For example, the RC5 works for 16F883 but not 16F1877.
We are looking into making the RC5 component work with a much wider range of target devices.
Ben and I had a look at this today.
As a temporary fix, can you try a C code block just after RX Enable with:

Code: Select all

T0CON1bits.T0CS = 2;
T0CON0 = 128;
T0CON1 = 66;
INTCON = 192;
the above is for around 20MHz
for 32MHz you will need

Code: Select all

T0CON1bits.T0CS = 2;
T0CON0 = 128;
T0CON1 = 67;
INTCON = 192
Martin

jan.didden
Posts: 59
Joined: Thu Dec 17, 2020 3:16 pm
Has thanked: 18 times
Been thanked: 12 times

Re: Looking for users with experience using RC5 remote control component

Post by jan.didden »

Gents, thanks, I was out for a few days getting a knee replaced. All fine now, I'm home fighting a pair of crutches ;-)
I am fairly sure I have (several) RC5 remotes and eyeball-decoding the previously shows scope screen shot shows what I think is RC5 code.
Will try Martins' tip with the C-block tomorrow.
And if this can be made universal for other code schemes that would really be good, as I have several units using NEC code which is really in favor these days.
Thanks for you help all,

Jan Didden

mnfisher
Valued Contributor
Posts: 399
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 49 times
Been thanked: 227 times

Re: Looking for users with experience using RC5 remote control component

Post by mnfisher »

Hope the knee is okay and the crutches behave...

I posted a NEC version of the above at viewtopic.php?f=10&t=1126&p=6150#p6150- if you could give it a try...

Martin

jan.didden
Posts: 59
Joined: Thu Dec 17, 2020 3:16 pm
Has thanked: 18 times
Been thanked: 12 times

Re: Looking for users with experience using RC5 remote control component

Post by jan.didden »

Feeling better today, have tried your linked code. No joy so far.
I am unfamiliar (as in 'no idea') with the way you set up that irPin as a 'property' connected to B2.
For instance, how is a changing B2 pin level transferred to the iRPin variable? There's no Input statement ...
So that's something I need to find out.
Also looking for a way to detect at least the start pulse.

Jan
Last edited by jan.didden on Tue Mar 22, 2022 12:35 pm, edited 1 time in total.

mnfisher
Valued Contributor
Posts: 399
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 49 times
Been thanked: 227 times

Re: Looking for users with experience using RC5 remote control component

Post by mnfisher »

Hi Jan,

The irPin is the pin you have the ir sensor is attached to. (I used port D.2 on Arduino) (Select in the 'properties' page)

It allows such niceties as "pin = 1" or ".x = pin" in a calculation box - but the real advantage is that if you change the pin used then you don't have to modify multiple 'output' or 'input' macros.

The main function watches for this changing (while irPin = 1 or until irPin = 0) - but it might be possible to 'sleep' the MCU and wake on a pin change for low power applications.

Martin

Post Reply