Searching \ for '[PIC]: interrupt handling on B0 (thnx 4 array siz' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Search entire site for: 'interrupt handling on B0 (thnx 4 array siz'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: interrupt handling on B0 (thnx 4 array siz'
2001\03\30@155410 by J.A.YOUNG

flavicon
face
Thanks very much to all for the array size stuff, I'm using the bit array to
store my potentials and wall data, so cutting down on memory, but will put in
my project that another type of chip would be more appropriate.

<using HiTech PICC-LITE under MPLAB for a PIC16F84A>

For the current pic i'm going to use the dead simple 'follow-the-left-hand-
wall' technique. I've written the basic code, but at the moment its a case
of "move 1 square, stop. read sensors. go again", so I'm trying to setup an
interrupt on RB0 so that when the Left-Hand Sensor changes, I can jump to the
decision code.

As yet my program runs and compiles but doesn't do anything on a change to B0.
I've kind of pieced the code I need together from the PICCLITE manual and other
tutorials, and can see there's stuff about option registers, but nothing I've
tried has made a difference. Code to try out the interrupt is below.

void interrupt sensor()
{
       int i;
       PORTA=255;
       for (i=40;i--;) continue;
}

main()
{
       TRISA=0;
       TRISB=3;

       //OPTION=192;        tried fiddling with this code but I'm just
       //INTCON|=(1<<GIE);             guessing really...

       for (;;)
       {
       PORTA=0;
       }
}

Simple stuff no doubt, but any ideas??? cheers,
john

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.



'[PIC]: interrupt handling on B0 (thnx 4 array siz'
2001\04\02@075949 by Oluseyi Odeinde
flavicon
picon face
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


2001\04\02@084836 by Oluseyi Odeinde

flavicon
picon face
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


2001\04\03@095513 by Oluseyi Odeinde

flavicon
picon face
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: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...