Timer interrupts calling a macro

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

Timer interrupts calling a macro

Post by TaliG »

Hi,
I do not know if this is a bug, or im doing something wrong, or it cannot be done.
When I am enabling a timer interrupt and calling a macro, then disabling this interrupt all goes well. Then I would like to use the same timer for enother interrupt, re enabling the timer interrupt (same timer) calling enother macro, but the macro that is called is the one from the first interrupt.
Im working on the 18f47k40 and soon will move to the 67k40 (pins are never enough :) ).

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: Timer interrupts calling a macro

Post by Benj »

Hello,

An interrupt can only ever call one macro due to the way the code generation works. If you enable an interrupt calling macroA and then disable and re-enable this time calling macroB then this will not work as you expect.

One way to get around this is by using a global variable. Enable your interrupt calling macroA and inside macroA check the state of the variable using a decision icon. Then instead of re-enabling using a different macro you can change the value of the variable.

Hope this helps.

TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

Re: Timer interrupts calling a macro

Post by TaliG »

what i already do is using a swich inside the macro, is this correct? thank you for your help!

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: Timer interrupts calling a macro

Post by Benj »

what i already do is using a swich inside the macro, is this correct?
Yes that should work fine.

Post Reply