Component sfk 433 Mhz serial for Arduino, ext.

medelec35
Matrix Staff
Posts: 692
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 242 times
Been thanked: 244 times

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by medelec35 »

Hi Jan.
I have found that if an interrupt enable is placed within another interrupt, it does indeed cause issues.
For example, it can restart all the code.
What I would do if I were you is to enable timer2 only once just below the enable INT0 enable icon .
Then just after the enable Timer2 icon, place a C code block with

Code: Select all

cr_bit(PIE4,TMR2IE);
which stops the interrupt from firing.
Use that c code to replace all the timer2 disable icons.
Then I would replace all the timer2 enable icons with a c code block containing

Code: Select all

st_bit(PIE4,TMR2IE);
Martin

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

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by jan.didden »

Martin, thanks, I will see if I can get it to work that way.
I had a hunch that it had to do with (illegal?) overwrite of interrupt register contents, or possibly just a coding error in the register/bit name, but didn't know how to check that.
Martin mnfischer confirmed it indeed is an issue.
You have restarted me ;-)

Jan

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

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by mnfisher »

Thanks Martin - a lot neater than my work round too I added a flag and restarted the timer on the main loop if not running.

Worked, but a bit clunky..

The interrupt rate given in the interrupt setup seems incorrect. By a factor of 4 - I had to set stated interrupt rate to 1/4 the desired rate.

Martin

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

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by medelec35 »

Hi Jan/Martin
Sorry, there was a typo in my code and I have corrected it.
The correct codes are

Code: Select all

cr_bit(PIE4,TMR2IE);
and

Code: Select all

st_bit(PIE4,TMR2IE);
The / should not have been present

I'm glad the information helped you to get restarted.

Thank you, Martin (mnfisher) for your great support to Jan and other members.
Your help is really appreciated by us all! :)
Martin

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

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by mnfisher »

Thanks Martin,

That works perfectly. Not quite as straightforward as on the AVR chip but all's well etc...

This isn't quite the right topic so I'll post the code to the NEC IR topic...

Martin

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

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by jan.didden »

Martin (medelec), just to be sure, your code enables/disables the timer but does not reset or clear it, correct?

Jan

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

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by mnfisher »

It doesn't clear the timer (though for our/most purposes it doesn't matter)

Martin

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

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by jan.didden »

I really would like to thank Martin mnfisher publicly for his support to get this project up and running.
I'm pretty sure he doesn't have loads of spare time but nevertheless always willing to listen and help.
There's a very long list of PM's between him and me.
I vote to give him a lifetime free FC update ;-)

Jan

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

Re: Component sfk 433 Mhz serial for Arduino, ext.

Post by mnfisher »

And thanks to Jan & Martin (medelec) too..

If possible I'd like a lifetime supply of spare time - there seems to be a lot less of it about with every passing year...

Martin

Post Reply