How can I use any Pin for Interrupt ?
Thanks for help
Amrat
Any Pin Interrupt
-
- Posts: 26
- http://meble-kuchenne.info.pl
- Joined: Sun Jan 31, 2021 11:25 am
-
- Valued Contributor
- Posts: 401
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 73 times
- Been thanked: 218 times
Re: Any Pin Interrupt
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.
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
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
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
-
- Valued Contributor
- Posts: 991
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 106 times
- Been thanked: 517 times
Re: Any Pin Interrupt
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
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
-
- Valued Contributor
- Posts: 1186
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 289 times
- Been thanked: 417 times
Re: Any Pin Interrupt
Hi
Following on from Martin, the WiKi has some examples that may further assist
https://www.flowcode.co.uk/wiki/index.p ... Interrupts
Regards
Following on from Martin, the WiKi has some examples that may further assist
https://www.flowcode.co.uk/wiki/index.p ... Interrupts
Regards
-
- Posts: 615
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 509 times
- Been thanked: 132 times
Re: Any Pin Interrupt
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 ) 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
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 ) 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 18 times
Re: Any Pin Interrupt
Dear All,
Thanks sincerely for sparing holiday time to reply. I am grateful and now I understand well.
Thanks again
Amrat
Thanks sincerely for sparing holiday time to reply. I am grateful and now I understand well.
Thanks again
Amrat