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