piclist 2001\04\02\084836a >
Thread: interrupt handling on B0 (thnx 4 array sizes)
www.piclist.com/techref/microchip/ints.htm?key=interrupt
flavicon
picon face BY : Oluseyi Odeinde email (remove spam text)



Hi John,

1st of all, if the ONLY interrupt u need enabled is RB0 then

INTCON = 90; //enables global and RB0 interrupts

2ndly, ur interrupt routine should be set up this way:

static void interrupt isr(void){
//RB0 interrupt
if (INTF){
   // do something
   INTF=0; //clear RB0 interrupt flag
}
}

FYI, u can only have one interrupt routine which means all ur interrupts
should be handled within that one routine! so for example if u needed to
have TMR0 interrupt enabled as well as RB0, then the above interrupt
routine would look like this:

static void interrupt isr(void){

//TMR0 interrupt
if (T0IF){
 // do something
 T0IF=0; //clear TMR0 interrupt flag
}

// RB0 interrupt
if (INTF){
   // do something
   INTF=0; //clear RB0 interrupt flag
}
}

hope this helps. BTW, if u needed to have TMR0 interrupt enabled, then u
would need to set the value in the OPTION register appropriately. this
might be a good time to have a look at the datasheet for the PIC in use.

seyi


"J.A.YOUNG" wrote:

{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


<3AC8736F.61F25626@ocean.cf.ac.uk> 7bit

See also: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) interrupt handling on B0 (thnx 4 array sizes)

month overview.

new search...