how to use interrupt?
how to use interrupt?
Hi,
I have to make a full stop in my program with a interrupt: the program can be stoped at any time or place, by pushing a button (C7)
It's the first year that I work with Flowcode, so I don't know how to use an interrupt.
can someone help me please?
Morfius
I have to make a full stop in my program with a interrupt: the program can be stoped at any time or place, by pushing a button (C7)
It's the first year that I work with Flowcode, so I don't know how to use an interrupt.
can someone help me please?
Morfius
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: how to use interrupt?
Hello Morfius
I dont think there is an interrupt that you can trigger via pin C7. Normally the interrupt pins are B0 and the upper 4 bits of PortB (B4 - B7).
The interrupt works by jumping from your main program into a macro when an event occurs. So you would use an interrupt icon in Flowcode, set to enable the interrupt near the start of your program outside of the main loop (dont want to keep calling this in your program). Create a macro to run when the interrupt occurrs. Next put the code into the interrupt macro that you want to run when the event occurs. When the interrupt macro is finished the chip will resume where it left off in your main program allowing interrupts to be triggered again. Using the disable interrupt icon will stop the specific interrupt from firing.
I dont think there is an interrupt that you can trigger via pin C7. Normally the interrupt pins are B0 and the upper 4 bits of PortB (B4 - B7).
The interrupt works by jumping from your main program into a macro when an event occurs. So you would use an interrupt icon in Flowcode, set to enable the interrupt near the start of your program outside of the main loop (dont want to keep calling this in your program). Create a macro to run when the interrupt occurrs. Next put the code into the interrupt macro that you want to run when the event occurs. When the interrupt macro is finished the chip will resume where it left off in your main program allowing interrupts to be triggered again. Using the disable interrupt icon will stop the specific interrupt from firing.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: how to use interrupt?
it doesn't work If I put the interrupt outside the loop (X<>128) ( I used B4,5,6,7 to activate the interrupt, but I only want B7 to activate the interrupt. If I put the interrupt in "decision", the interrupt doesn't work.
Very strange, no?
Very strange, no?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: how to use interrupt?
Hello Morfius
Attach your program to the forum if you like and I will have a quick look for you and see if I can spot any potential problems.
Attach your program to the forum if you like and I will have a quick look for you and see if I can spot any potential problems.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: how to use interrupt?
Hello
If you want to stop your programme for good , try this.
For restart, you will have to reset the Pic or power off.
Daniel
If you want to stop your programme for good , try this.
For restart, you will have to reset the Pic or power off.
Daniel
- Attachments
-
- FlowcodeEND-mod.fcf
- (6 KiB) Downloaded 302 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: how to use interrupt?
Hello
I have made a few mods to allow your program to function a bit better. Though looking at Dans example this may be better for a complete end to your program.
I have made a few mods to allow your program to function a bit better. Though looking at Dans example this may be better for a complete end to your program.
- Attachments
-
- FlowcodeEND_mod2.fcf
- (6 KiB) Downloaded 337 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: how to use interrupt?
Hello
You can download the latest version of Flowcode from here.
http://www.matrixmultimedia.com/Downloa ... k.php?id=2
Then you will be able to open the files.
You can download the latest version of Flowcode from here.
http://www.matrixmultimedia.com/Downloa ... k.php?id=2
Then you will be able to open the files.
- Attachments
-
- example.JPG (72.59 KiB) Viewed 7665 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: how to use interrupt?
thanks a lot!
I know now how to use interrupt (basics)
I made an interrupt macro on my way. So I didn't just copy
I don't understand your way fully yet, but I will study it further.
thanks for your help

I know now how to use interrupt (basics)
I made an interrupt macro on my way. So I didn't just copy
I don't understand your way fully yet, but I will study it further.
thanks for your help