RC5 receive functionality

Any bugs you encounter with Flowcode should be discussed here.
jan.didden
Posts: 82
http://meble-kuchenne.info.pl
Joined: Thu Dec 17, 2020 3:16 pm
Has thanked: 20 times
Been thanked: 12 times

RC5 receive functionality

Post by jan.didden »

Hello,

I purchased the commsb pack for the RC5 component. There is also a short demo programme for the RC5 component, but that does give me some error messages I don't understand, see below. What am I doing wrong?

Code: Select all

Build date: Jul 30 2019
Part Support Version: 2.10
Copyright (C) 2019 Microchip Technology Inc.
RC5_Test_Rx.c: myisr()
  1462:	FCD_01bf2_RC5__Signal_Edge();
	^ (361) function declared implicit int (warning)
  1482:	FCD_01bf2_RC5__Timer_Event();
	^ (361) function declared implicit int (warning)
using updated 32-bit floating-point libraries; improved accuracy might increase code size
C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC\PIC_CAL_IO.c: 216: non-reentrant function "_FC_CAL_Port_In_DDR__x" appears in multiple call graphs and has been duplicated by the compiler
RC5_Test_Rx.c: 764: non-reentrant function "_FCD_01bf1_RC51__Initialise_States" appears in multiple call graphs and has been duplicated by the compiler
0: (500) undefined symbols:
	_FCD_01bf2_RC5__Signal_Edge(RC5_Test_Rx.obj) _FCD_01bf2_RC5__Timer_Event(RC5_Test_Rx.obj) 
(908) exit status = 1
(908) exit status = 1

Error returned from [xc8.exe]

C:\ProgramData\MatrixTSL\FlowcodeV9\FCD\PIC\batch\pic_xc8_comp.bat reported error code 0x1
Attachments
RC5_Test_Rx.fcfx
(13.39 KiB) Downloaded 89 times

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

Re: RC5 receive functionality

Post by jan.didden »

Reading up a bit on RC5, there appears several coding methods exist, like the original Philips RC5 (bi-phase coding) or the NEC method, PWM coding. Does the Flowcode component handle only the original (Philips) RC5 bi-phase coding or does it also handle the PWM coding scheme as used by NEC? (My intended use is for NEC coding).

Also, what is the difference between RC5 and RC51 in the properties settings?

Jan Didden

medelec35
Matrix Staff
Posts: 1450
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 509 times
Been thanked: 472 times

Re: RC5 receive functionality

Post by medelec35 »

Hi Jan.
The issue with your flowchart is you added an additional RC5 component.
The RC51 is the RC5 component, but the last number is incremented every time you add a duplicate component.
If you added the third RC5 it will be RC53 etc.
As far as I'm aware The RC5 will only work with the RC5 protocol.
I have removed the additional RC5 and resized the original for you.
If you are importing from a flowchart where components were 2D/3D but are now the new 2D only style, then they will be tiny.
You will need to resize them.
If there are too many to resize then we can help.
Attachments
RC5_Test_Rx 2.fcfx
(11.7 KiB) Downloaded 96 times
Martin

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

Re: RC5 receive functionality

Post by jan.didden »

Martin, thank you, that works! Funny enough, I deleted all RC5 related components and started with a clean flowchart, but couldn't get rid if the issues.
Your example compiles clean.
I think I'm all set now!

Jan Didden

medelec35
Matrix Staff
Posts: 1450
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 509 times
Been thanked: 472 times

Re: RC5 receive functionality

Post by medelec35 »

That's brillant.
Thanks for letting us know.
Martin

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

Re: RC5 receive functionality

Post by jan.didden »

Hmm. It seems an interrupt service routine can only be called from either a falling edge or a rising edge on a pin.
For this setup, I need to service both a falling and a rising interrupt.
The h/w of the PIC16F15355 can be set to interrupt on both a rising and a falling edge on a particular pin.
Is there a workaround that anybody knows of?
Maybe I could define two input pins as sources of an int, one on a rising edge, one on a falling edge, both calling the same service routine, but that seems a bit convoluted.

Jan

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

Re: RC5 receive functionality

Post by jan.didden »

And for a lighter note:

prog.PNG
prog.PNG (135.06 KiB) Viewed 2570 times

BenR
Matrix Staff
Posts: 1733
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 439 times
Been thanked: 602 times

Re: RC5 receive functionality

Post by BenR »

Hello,

Enabling the interrupt twice won't work as it will just set the edge to the last enabled edge. However you can take charge of the edge control bit yourself.

First enable the interrupt for the first edge you want to catch, e.g. rising.

Inside the interrupt macro increment a counter and then create a decision based on (counter & 1). This will be true on every odd count and false on every even count.

Yes branch C code icon - Interrupt on falling edge

Code: Select all

OPTION_REGbits.INTEDG = 0;
No Branch C code icon - Interrupt on rising edge

Code: Select all

OPTION_REGbits.INTEDG = 1;
Then as long as the edges aren't happening too fast you should interrupt on all edges.

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

Re: RC5 receive functionality

Post by jan.didden »

Thanks Ben, that's a good tip.
At this moment I'm only looking at a rising edge, because I think that looking at rising edges only gives me an umambiguous pulse length.
Those NEC message designers were pretty smart!

Jan

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

Re: RC5 receive functionality

Post by jan.didden »

Next hurdle. For some reason, the timer returns zero elapsed time, even with a deliberately inserted 4ms delay.
Looking at the timer properties there is a 2MHz coount rate specified with no option to change it.
Does FC, knowing the osc freq, insert a prescaler to get to 2MHz?
My processor runs at 32MHz.
Could that give a conflict?

Edit: a 2MHz instruction rate implies an 8MHz clock, right.

Jan Didden
Attachments
T1.PNG
T1.PNG (25.97 KiB) Viewed 2527 times
eDD NECdec-3.fcfx
(22.53 KiB) Downloaded 70 times

Post Reply