Using interrupts

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

Moderators: Benj, Mods

Post Reply
fifafrazer
Posts: 4
Joined: Thu Jan 18, 2007 7:43 pm
Contact:

Using interrupts

Post by fifafrazer »

I'm using flowcode version 3.0.3.28.

I've set RB0 as an interrupt. RB0/INT - interrupt on the falling edge.
A push-to-make button is connected to RB0.
Here comes the problem:
When i simulate the program, the interrupt only occurs when the switch is pressed, and not when it is released.
I've also tried to set the interrupt to "the rising edge", and the interrupt still only occurs when the button is pressed, and not when it is released. The properties of the interrupt doesnt seem to work. This must be a bug?

Another question: Is it possible to prevent the interrupt macro from clearing the interrupt flag (INTF), or do I have to do it manually in the C file?

If I have to do it manually, how do I compile the custom C-code to the chip?

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

Thanks for the bug report - it is a bug and I have now fixed it. We'll release a patch sometime next week with this fix.

As for the clearing of INTF, there is currently no way of preventing this nicely. The only way would be to edit the FCD file for the chip you are using and editing this line:

Code: Select all

IntHandler="if (%r & (1 << %b))\n{\n\tFCM_%n();\n\tclear_bit(%r, %b);\n}\n"
to this:

Code: Select all

IntHandler="if (%r & (1 << %b))\n{\n\tFCM_%n();\n\t//clear_bit(%r, %b);\n}\n"
This is not an elegant workaround, because this will affect all interrupt calls for that chip.

Out of interest, why do you want to keep the INTF flag set once you have serviced the interrupt?

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:

Post by Benj »

Instead of trying to keep the interrupt flag set you could disable the interrupt as soon as you hit the service routine and then re-enable it when you jump back to your main program.

Post Reply