Looking for users with experience using RC5 remote control component

For general Flowcode discussion that does not belong in the other sections.
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

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

Post by jan.didden »

Hi Martin, I don't see this changing irPin. Whenever I send an IR cmd, I can see the pin change on the scope but the software doesn't appear to 'get' it.
That's why I asked.
It may have to do with my particular micro, a 16F15355, which has PPS (pin property registers) for most of the pins.
Possibly I need to set the PPS bit for the relevant pin.
BTW How/where do you define such a pin?

Jan

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

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

Post by mnfisher »

I don't think you need to set the PPS register..

The pin needs to be set in the panel properties. (view->properties if it's hidden)

I do have some PIC kit I can test it on - but I'm at work at present - will have a play tomorrow (Tuesday is a long day:-( )

Martin

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

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

Post by jan.didden »

I understand the concept, but I don't know where those variables (?) .state and .data and such come from.
They are not defined as far as I can see. I never encountered these .xxx identifiers so probably I expose here my limited understanding of these concepts.
I'm just a simple FC user ...

Jan Didden

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

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

Post by mnfisher »

.state and .data are local variables - they are initialized in their definitions (.state for example is initialized to idle)

The 'local variable' tab is just to the right of the global variable tab in the project explorer (the dot notation is also used for parameters passed to macros which are also local)

Their use helps keep your code readable and can avoid 'side-effects' - and I would recommend their use :-)

Can you post your code or pm it...

Martin

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

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

Post by jan.didden »

Gentlemen,

I've been diverted by other stuff (had to have a knee replaced - all titanium now ;-).
But I want to pick up the NEC decoding, which should run under interrupt control. The idea is to start a timer, then when an interrupt-on-change (both rising & falling edge) from the IR receiver pin occurs, read the elapsed time to decode stuff.
First step is to see if I can reset, start and stop T0 to check elapsed time. See attached.
Why does this not work? What am I overlooking?

Jan Didden
Attachments
eDD NECdec-1.fcfx
(12.95 KiB) Downloaded 74 times

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

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

Post by mnfisher »

One issue is that iTimerValue is a byte so overflow might have occurred (you don't reset the timer in StartCounter - so it might be at 1002? following reset / delay)

Still gives 0 in simulation though even after changing this - what happens on hardware?

Martin

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

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

Post by jan.didden »

Yes - Int, my bad.
I'll see if I can whip something up on h/w tomorrow.
I also wasn't sure how to handle the fact that the timer read returns an Unsigned Integer, but with values this low, it should be OK to convert to Int for printing.

Jan

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

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

Post by mnfisher »

One thing I notice in simulation is that it might be running faster than an MCU - so 2ms delay gives 0 (1s gives 800ms)... Try adding a longer delay.

On my PC - changing 2ms to 200ms displays 150ms on the display (in simulation)

Martin

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

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

Post by jan.didden »

Martin, seems to work in h/w! Tried just a few numbers for ms delay, and they are correctly shown on the display.
Funny enough, in simulation, as soon as I reset the counter in the flowchart, the counter in the 2D panel starts to count up to a value of around 3 (+/- 0.1).
Ohh the intricacies of software ;-)
Onwards, always onwards!

Jan
Attachments
eDD NECdec-2.fcfx
(18.84 KiB) Downloaded 69 times
Last edited by jan.didden on Tue May 03, 2022 11:16 am, edited 1 time in total.

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

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

Post by mnfisher »

Under 'View' menu - project explorer...

Martin

Post Reply