Any Pin Interrupt

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Amrat
Posts: 26
http://meble-kuchenne.info.pl
Joined: Sun Jan 31, 2021 11:25 am

Any Pin Interrupt

Post by Amrat »

How can I use any Pin for Interrupt ?
Thanks for help
Amrat

LeighM
Valued Contributor
Posts: 401
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 70 times
Been thanked: 217 times

Re: Any Pin Interrupt

Post 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.

Amrat
Posts: 26
Joined: Sun Jan 31, 2021 11:25 am

Re: Any Pin Interrupt

Post 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

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

Re: Any Pin Interrupt

Post 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

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: Any Pin Interrupt

Post 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

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: Any Pin Interrupt

Post 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
Attachments
Multi_Interrupt_Interrupt.fcfx
(20.42 KiB) Downloaded 15 times

Amrat
Posts: 26
Joined: Sun Jan 31, 2021 11:25 am

Re: Any Pin Interrupt

Post by Amrat »

Dear All,

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

Thanks again
Amrat

Post Reply