View previous topic :: View next topic |
Author |
Message |
rajeshkhan808
Joined: 29 Aug 2012 Posts: 17
|
General Information about Interrupts in PIC 16F877A (Solved) |
Posted: Fri Aug 31, 2012 6:29 am |
|
|
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
|
|
Posted: Fri Aug 31, 2012 8:42 am |
|
|
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: 19498
|
|
Posted: Fri Aug 31, 2012 9:16 am |
|
|
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
|
|
Posted: Fri Aug 31, 2012 9:47 am |
|
|
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
|
|
Posted: Sat Sep 01, 2012 1:34 am |
|
|
Thanks that helped |
|
|
|