CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

General Information about Interrupts in PIC 16F877A (Solved)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rajeshkhan808



Joined: 29 Aug 2012
Posts: 17

View user's profile Send private message

General Information about Interrupts in PIC 16F877A (Solved)
PostPosted: Fri Aug 31, 2012 6:29 am     Reply with quote

The Datasheet states that:


The PIC16F87XA family has up to 15 sources of
interrupt. The Interrupt Control register (INTCON)
records individual interrupt requests in flag bits. It also
has individual and global interrupt enable bits.


I am enabling my interrupt using the following

#int_rb
void button_isr()
{
//Some interrupt method
}
void main()
{
enable_interrupts(global);
enable_interrupts(int_rb);
ext_int_edge( H_TO_L );
......
}

I wanted to know why cant I use the B0 pin as an interrupt?
also I have only discovered 4 interrupt RB4->RB7 Where are the others?


Last edited by rajeshkhan808 on Mon Sep 03, 2012 8:04 am; edited 1 time in total
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Fri Aug 31, 2012 8:42 am     Reply with quote

Due to the number of features data sheets don't tell you all you need to know in a paragraph or two. Many have to read the whole data sheet a few times before really understanding all the features. Fortunately many PIC devices have similarities so with experience you can speed read some sections after having mastered the first few devices. As to the the rb interrupt pins..... look at the port diagram and see which pins have paths to the interrupt logic then read the written description again and see if you now understand it.
Ttelmah



Joined: 11 Mar 2010
Posts: 19238

View user's profile Send private message

PostPosted: Fri Aug 31, 2012 9:16 am     Reply with quote

RB (interrupt on change), is only available 'on' B4 to B7.
This is down to the chip hardware.
However B0, offers INT_EXT. High _or_ low level interrupt (but not change).
Read up on this in the data sheet.

Data sheet, does tell you everything about this, but what the fifteen sources are is not just 15 pins:
INT_RB, is _one_ source (though four pins).
UART (two interrupts)
SSP
CCP1
CCP2
TIMER1
TIMER2
PSP
RTCC
AD
COMP
BUSCOL
EEPROM
EXT (B0)

These are all the 'sources', then you have to look at what hardware event triggers them. For your INT_RB, it is a _change_ on one of the high four PORT B pins. For 'INT_EXT', it is the level going from either high to low, or low to high (INT_EDGE controls which). Then the UART, has two interrupts, but is only deemed one 'source'. etc. etc..

As Douglas Kennedy says, you can't just look at one paragraph, and assume....

Best Wishes


Last edited by Ttelmah on Sat Sep 01, 2012 1:45 am; edited 1 time in total
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Aug 31, 2012 9:47 am     Reply with quote

read table 3-3 of the data sheet

and in general - make it your FIRST stop:

it will save you a lot of puzzlement

am i the only one who is noticing a VAST lack of
not reading the data sheet ?
rajeshkhan808



Joined: 29 Aug 2012
Posts: 17

View user's profile Send private message

PostPosted: Sat Sep 01, 2012 1:34 am     Reply with quote

Thanks that helped
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group