Disabeling interrupt

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Disabeling interrupt

Post by Jan Lichtenbelt »

Hi All,

I want to use the INT-interrupt on port RB0 of 16F887A. But I want both high-to-low and low-to-high interrups.
Is the next set up possible:
1) enable INT interrupt on high-to-low with macro HtL.
2) if interrupt occursin macro HtL I increase a counter, disable the interrupt and enable a new interrupt on low-to-high with macro LtH,
3) the same for this macro HtL, increse a counter, disable the interrupt and start HtL intterupt again.

Kind reagrds

Jan Lichtenbelt

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: Disabeling interrupt

Post by Benj »

Hi Jan,

Yes this is possible as we use this mechanism for one of the RC5 receive options.

You can keep the interrupt enabled and simply use the lines of C code below to switch the INT operation.

option_reg.INTEDG = 0; //Set the INT0 interrupt to trigger on falling edge

option_reg.INTEDG = 1; //Set the INT0 interrupt to trigger on rising edge

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: Disabeling interrupt

Post by Jan Lichtenbelt »

Dear Ben,

Some like this, with the Timer2 Interrupt_Counter?

if test_bit(option_reg,INTEDG)
{
clear_bit(option_reg,INTEDG); //Set the INT0 interrupt to trigger on falling edge
FCV_INTERRUPT_COUNTER=0;
}
else
{
set_bit(option_reg,INTEDG) ; //Set the INT0 interrupt to trigger on rising edge
FCV_TIME_ON= FCV_INTERRUPT_COUNTER;
}
Kind regards

Jan

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: Disabeling interrupt

Post by Jan Lichtenbelt »

The RB0/INT interrupt works both on rising and falling edge in one macro, see attachment.
Attachments
RB0_INT test.fcf
(6 KiB) Downloaded 283 times

Post Reply