PIC18F4685 RB0/INT0 & RB1/INT1 interrupt.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Speedy2k
Posts: 91
Joined: Mon Aug 06, 2012 5:04 am
Has thanked: 2 times

PIC18F4685 RB0/INT0 & RB1/INT1 interrupt.

Post by Speedy2k »

Is it possible to trigger the RB0/INT0 and RB1/INT1 interrupts on both rising edge and falling edge? Right now in flowcode i can only choose one or the other?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: PIC18F4685 RB0/INT0 & RB1/INT1 interrupt.

Post by Enamul »

The trick that Ben told and Jan used...
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
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;
}
Attachments
RB0_INT test.fcf
(6 KiB) Downloaded 289 times
Enamul
University of Nottingham
enamul4mm@gmail.com

Speedy2k
Posts: 91
Joined: Mon Aug 06, 2012 5:04 am
Has thanked: 2 times

Re: PIC18F4685 RB0/INT0 & RB1/INT1 interrupt.

Post by Speedy2k »

Ok and what is the option.reg for the rb1/int1?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: PIC18F4685 RB0/INT0 & RB1/INT1 interrupt.

Post by Enamul »

Actually it will be like the following for your chip..
For INT0

Code: Select all

if test_bit(intcon2,INTEDG0)
{
clear_bit(intcon2,INTEDG0); //Set the INT0 interrupt to trigger on falling edge
FCV_INTERRUPT_COUNTER=0;
}
else
{
set_bit(intcon2,INTEDG0) ; //Set the INT0 interrupt to trigger on rising edge
FCV_TIME_ON= FCV_INTERRUPT_COUNTER;
}
For INT1

Code: Select all

if test_bit(intcon2,INTEDG1)
{
clear_bit(intcon2,INTEDG1); //Set the INT0 interrupt to trigger on falling edge
FCV_INTERRUPT_COUNTER=0;
}
else
{
set_bit(intcon2,INTEDG1) ; //Set the INT0 interrupt to trigger on rising edge
FCV_TIME_ON= FCV_INTERRUPT_COUNTER;
}
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: PIC18F4685 RB0/INT0 & RB1/INT1 interrupt.

Post by Enamul »

Please let me know if you struggle in flowcode for that.. I will post but you can always try first.
Enamul
University of Nottingham
enamul4mm@gmail.com

Speedy2k
Posts: 91
Joined: Mon Aug 06, 2012 5:04 am
Has thanked: 2 times

Re: PIC18F4685 RB0/INT0 & RB1/INT1 interrupt.

Post by Speedy2k »

Thanx a lot Enamul, you are the man! and thanx to everyone who help on this forum, this is pretty awesome!! I am always impresed by all the help avaible here! This is what make flowcode so awesome!!

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: PIC18F4685 RB0/INT0 & RB1/INT1 interrupt.

Post by Enamul »

I am happy that it helps you and it pleases my heart. Thanks
Enamul
University of Nottingham
enamul4mm@gmail.com

Post Reply