Page 1 of 1

16F1825 IOC problem

Posted: Thu Dec 05, 2019 3:48 pm
by DirkB
Hello,

have found a bug. If you activate several interrupts,
only the last one of the activated interrupts will work.
All others ioc-interrupts will be deactivated.

regards

Dirk

Re: 16F1825 IOC problem

Posted: Thu Dec 05, 2019 4:04 pm
by stefan.erni
Hi Dirk

I'm working with different IOC and a Pic. I use a PIC32MZ. There its working. Can you post your program. So we can have a look.

regards

Stefan

Re: 16F1825 IOC problem

Posted: Thu Dec 05, 2019 4:28 pm
by DirkB
Hello Stefan,

I wrote a little test program, only with two interrupts.
It is absolutely reproducible. But I even need 5 interrupts.

Grüsse

Dirk

Re: 16F1825 IOC problem

Posted: Thu Dec 05, 2019 5:16 pm
by stefan.erni
Hoi Dirk

Should not you change ON_B and ON_A somewhere? Otherwise, all Int will be set port A2 to 0

Gruss
Stefan

Re: 16F1825 IOC problem

Posted: Thu Dec 05, 2019 6:10 pm
by DirkB
Hi Stefan,

he he, yes, sorry. I was right before with an Display
together and for the test accidentally deleted with.

Here the right program.

Liebe Grüsse

Dirk

Re: 16F1825 IOC problem

Posted: Fri Dec 06, 2019 10:51 am
by Benj
Hi Dirk,

Aha I see what you're doing now. You cannot re-enable the same interrupt multiple times. You need to enable the interrupt for all the pins it could be used with in a single icon. Inside the interrupt macro you can determine which pin triggered the interrupt by saving the state of the pins during the prevous interrupt and comparing.

Re: 16F1825 IOC problem

Posted: Sat Dec 07, 2019 9:47 am
by DirkB
Hi Ben,

argh….., i am the bug. Is there no way to get
an own macro for every single int-pin?

regards

Dirk

Re: 16F1825 IOC problem

Posted: Mon Dec 09, 2019 11:11 am
by Benj
Hi Dirk,
argh….., i am the bug. Is there no way to get
an own macro for every single int-pin?
Using a single IOC interrupt you can only enable it once for the selected pins. As I say you can then check to see which pin fired the interrupt and then call another pin specific macro from here if you wish. Note that while you are inside the interrupt macro the interrupt cannot fire again.

It really depends what you're doing but something like this might help.

IOC interrupt Macro - Store pin states in a variable and check to see which pin cause the last interrupt, store this in a variable too. Return ASAP.

Main - Poll the variables and action them as nessisary.