Page 2 of 5

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

Posted: Tue Mar 22, 2022 12:40 pm
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

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

Posted: Tue Mar 22, 2022 12:50 pm
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

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

Posted: Wed Mar 23, 2022 9:09 am
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

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

Posted: Wed Mar 23, 2022 10:30 am
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

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

Posted: Mon May 02, 2022 4:12 pm
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

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

Posted: Mon May 02, 2022 7:06 pm
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

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

Posted: Mon May 02, 2022 7:14 pm
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

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

Posted: Mon May 02, 2022 7:59 pm
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

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

Posted: Tue May 03, 2022 10:40 am
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

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

Posted: Tue May 03, 2022 11:13 am
by mnfisher
Under 'View' menu - project explorer...

Martin