how to use interrupt?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Morfius
Posts: 9
Joined: Tue Feb 10, 2009 4:12 pm

how to use interrupt?

Post by Morfius »

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

User avatar
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?

Post by Benj »

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.

Morfius
Posts: 9
Joined: Tue Feb 10, 2009 4:12 pm

Re: how to use interrupt?

Post by Morfius »

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?

User avatar
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?

Post by Benj »

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.

Morfius
Posts: 9
Joined: Tue Feb 10, 2009 4:12 pm

Re: how to use interrupt?

Post by Morfius »

Ok thanks
Attachments
FlowcodeEND.fcf
(6 KiB) Downloaded 319 times

User avatar
Dan81
Valued Contributor
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?

Post by Dan81 »

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
Attachments
FlowcodeEND-mod.fcf
(6 KiB) Downloaded 302 times

User avatar
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?

Post by Benj »

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.
Attachments
FlowcodeEND_mod2.fcf
(6 KiB) Downloaded 337 times

Morfius
Posts: 9
Joined: Tue Feb 10, 2009 4:12 pm

Re: how to use interrupt?

Post by Morfius »

can you make a picture of it?
I can't open this file.
sorry

User avatar
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?

Post by Benj »

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.
Attachments
example.JPG
example.JPG (72.59 KiB) Viewed 7665 times

Morfius
Posts: 9
Joined: Tue Feb 10, 2009 4:12 pm

Re: how to use interrupt?

Post by Morfius »

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

Post Reply