piclist 2008\07\28\160532a >
Thread: Interrupt Questions
picon face BY : Richard Seriani, Sr. email (remove spam text)

----- Original Message -----
From: "threewheeler7" <threewheeler7spamRemoveMEhotmail.com>
To: <spampiclistspam_OUTspamSTOPspammit.edu>
Sent: Monday, July 28, 2008 3:07 PM
Subject: [PIC] Interrupt Questions

> I really have not had too much experience with interrupts, i have built
> and
> coded a few things that should have had them, mostly for the reason that
> way
> back when i first started learning about PICs, i was always warned how
> hard
> interrupts where to implement and that i should find a way to work without
> them.

Not necessarily difficult, it just means a little bit of studying about what
they are, how they work, and how to implement them. If you were "always"
warned about how difficult they are to implement, you were being done an
disservice. They definitely have their place in programming any
microprocessor or microcontroller. In fact, I dare say, you can 't get
along without them if you are going to do any serious, or even semi-serious,

>  so that turned me off from them for the longest time. but i know they
> have there place and i need to start using them more. So 1. if i am using
> RB0/INT as my interrupt source, can i still read RB0 as a bit without
> disabling interrupts? ie. waiting for input to fall back down.

Once enabled as an interrupt, what purpose would be served by reading the
pin? A change of state on RB0 will initiate an interrupt - what you decide
to do with that information is up to you. You can ignore it or you can use
that information to do something. If you want to use RB0 for some other
purpose  (as a general purpose I/O pin), you should disable the interrupt.

> also can i
> exit a interrupt routine with a "goto" instead of a "retfie"? ie. if i
> need
> to stop the program from what its doing and do something completely
> different.

I supose you could but, if you think you need to, you likely don't really
want to use an interrupt to accomplish whatever it is you are trying to do.
You don't have an unlimited stack, so how are you going to handle stack
overflow after the number of times you get an interrupt exceeds stack size?
How are you going to re-enable the interrupt? How are you going to handle
situations where you 'interrupted' a routine that produces an change to an
output that you need to know the result of, if you don't return to the point
it was interrupted?

Please take a look at the datasheet for your PIC; it probably contains some
discussion about the RB0 interrupt. If you are using a mid-range PIC, the
mid-range family reference (available on the Microchip site) gives a bit
more info. I also recommend you try a Google search for the words PIC
tutorial; many of the hits you will get cover interrupts in general, and the
RB0 interrupt in particular. Some are better than others but, as you learn
and experiment, you'll be able to spot the not-so-good ones.

Good luck and have fun learning.


<055f01c8f0ed$406b5330$6701a8c0@RICHARD> 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 Questions

month overview.

new search...