Page 1 of 1

Any Pin Interrupt

Posted: Sat Mar 09, 2024 1:43 am
by Amrat
How can I use any Pin for Interrupt ?
Thanks for help
Amrat

Re: Any Pin Interrupt

Posted: Sat Mar 09, 2024 10:10 am
by LeighM
Use the Flowcode Interrupt icon
Add it once at the start of your main program.
It has properties where you set the input pin to be used, and the macro to call when the interrupt occurs.

Re: Any Pin Interrupt

Posted: Sun Mar 10, 2024 12:49 am
by Amrat
Thanks.
But I mean normally I can use INT0 INT1 or other interruot shown in drop list.
But I want to use other Pin, ie D4 but I cant make it work !!
Any suggestion ?

Thanks again
Amrat

Re: Any Pin Interrupt

Posted: Sun Mar 10, 2024 7:26 am
by mnfisher
Which MCU are you using. Some, such as the Atmega 328p in the Arduino only have hardware interrupts on specific pins.

Other MCUs allow more pins to be used - look up custom interrupt in the Wiki.

There is an Arduino library that mimics interrupts on any pin - but this just checks the pin state regularly and calls a function of it has changed - it isn't a true interrupt.

Martin

Re: Any Pin Interrupt

Posted: Sun Mar 10, 2024 7:41 am
by chipfryer27
Hi

Following on from Martin, the WiKi has some examples that may further assist

https://www.flowcode.co.uk/wiki/index.p ... Interrupts

Regards

Re: Any Pin Interrupt

Posted: Sun Mar 10, 2024 7:43 am
by jgu1
Hi Amrat!

Try first Martin´s advice. (he is the best ;) )

Another way I used for time ago, I use the Interrupt Timer. I have made a small testprogram you can look at, only test in simulation.

The interrupt timer check if any input or "something happend". But from experience and from all the very good programmer here in forum (ok Martin, Chipfreyr :lol: ) Don´t use delay´s or other component macro in the user macro called from the Interrupt timer, only flags, read input and counter ect.

Maybe my little examble could help you a little or ideas? :)

Br jorgen

Re: Any Pin Interrupt

Posted: Sun Mar 10, 2024 8:10 am
by Amrat
Dear All,

Thanks sincerely for sparing holiday time to reply. I am grateful and now I understand well.

Thanks again
Amrat