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 ).
Timer interrupts calling a macro
Moderator: Benj
- 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
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.
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.
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
-
- 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
what i already do is using a swich inside the macro, is this correct? thank you for your help!
- 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
Yes that should work fine.what i already do is using a swich inside the macro, is this correct?
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