using Interrupts....

Status
Not open for further replies.

striker2509

New Member
How can i set the port b as an interruption....i want to take tha value in that port everytime i change a input pin....help me please!
 
you must specify on wich PIC do you work? :?:

but there is a special source of interruption for PORTB

1st on pin0

2nd on changes at B port

i think you must enabel all interrupt & set correctly the "INTCON" register
i am not about the register nam

& olso set the interrupyion vector on 0x04 EX:
org 0x04
goto interruption

interruption is the label of the sub routin for reading portb

i will give you more details after i chek the DATASCHEET
 
striker2509 said:
How can i set the port b as an interruption....i want to take tha value in that port everytime i change a input pin....help me please!

sorry about that...im using pic16f877, i tried to interrupt through rb4-rb7 pins...and didn't work out....dont know what i did wrong
 
Just enable the interrupts with.

Code:
            bsf    INTCON,RBIE
            bsf    INTCON,GIE

In your interrupt you need to read port b before resetting RBIF
I.E.
Code:
            movfw  PORTB
            bcf    INTCON,RBIF

HTH

Mike.

Edit, you will only get an interrupt if a change happens to any of the b4 - b7 bits that are inputs, not outputs. Note also, the datasheet doesn't mention RBIE in the description under PORTB - only RBIF.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…