View previous topic :: View next topic |
Author |
Message |
overmindx
Joined: 06 Oct 2008 Posts: 43
|
pic with 7 external interrupts |
Posted: Thu Mar 12, 2015 11:34 pm |
|
|
hi,
has anybody here used a pic with 7 external interrupts? if so, can i have the model of the chip. cant seem to find it anywhere.
thanks
bryan |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 13, 2015 12:41 am |
|
|
What about the 16F1847 ? It has one external interrupt, INT_EXT.
It also has eight interrupt-on-change pins, RB0 to RB7. Each one is
individually programmable for interrupt or not, and for rising edge or
falling edge.
I can find the PICs that have this feature (at least for 16F and 18F)
by using a text search program on the Devices directory and searching
for this: INT_RB4_L2H
I get these series of PICs that have it:
16F14xx
16F15xx
16F16xx
16F17xx
16F18xx
16F19xx
The 16F16xx and 16F17xx series (and LF versions) have IOC pins on
many other ports, not just PortB. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Fri Mar 13, 2015 1:49 am |
|
|
As a 'caveat' to this, when using these interrupts you have to clear the specific IOC bit yourself. A search here will find posts about how to do this.
Then as a second comment, for more 'up market' chips, the PIC24's for example, have large numbers of pins programmable for interrupt on change (often up to perhaps 24 pins).
Then remember that there is nothing to stop you attaching an external interrupt controller.
Then, 'be sure' that you really need so many interrupts. There are a lot of posts here for example, from people wanting to use interrupts as a way of scanning keypads, when these are not really the ideal solution to doing this. Keypad's as a source, are 'noisy', and do not need a 'uSec' deterministic response. If you look at the code used in things like PC keyboards, these always do the scanning using a timer 'tick', rather than interrupts. Using interrupts for this job, actually creates more problems than it solves, so make sure that your problem really does need to use interrupts. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Fri Mar 13, 2015 7:52 am |
|
|
one thing i learned about interrupts:
Too many enabled interrupts can negatively influence time domain determinism in your program.
Sometimes "too many" can even be ONE.
Basically, try by design to never use an int where simple polling will do the trick.
an example would be a long term time base counter for 1 second rollovers
using an 18F timer 0.
Though you'd be tempted to use an INT, i typically just poll/reset the
overflow flag, and increment a 32 bit var as part of a master WHILE() loop in MAIN().
this is especially important if you have any time critical routines in your foreground code.
That lets you avoid disabling and re-enabling master INTS when executing such items. |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Fri Mar 13, 2015 10:34 am |
|
|
In the other hand...
This monster PIC24EP512GU814 144 pins have a total of 16 Input capture modules.... (can be used as an external interrupt!!)
The cheapest is the PIC24FJ64GA106 with 9 IC/external interrupt _________________ Regards,
Laurent
-----------
Here's my first visual theme for the CCS C Compiler. Enjoy! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Fri Mar 13, 2015 3:23 pm |
|
|
You don't need to use the input capture modules.
As I said, the PIC24's support programmable interrupt on change.
Small chips like the PIC24FJ32MC102, have CNx programmable on just about every I/O pin. Single interrupt, but the corresponding CNx bit gets set, so you can tell exactly which pin triggered it. |
|
|
Arizona Chris
Joined: 20 Dec 2014 Posts: 69 Location: Arizona
|
Interrupts |
Posted: Sat Mar 14, 2015 8:32 am |
|
|
Id like to add that by adding some external OR gates, you can use one interrupt and simply OR all of the requests together into one. Remember that a hardware solution is far easier to trouble shoot than a software one!
Chris |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
Re: Interrupts |
Posted: Sat Mar 14, 2015 8:59 am |
|
|
Arizona Chris wrote: | Id like to add that by adding some external OR gates, you can use one interrupt and simply OR all of the requests together into one. Remember that a hardware solution is far easier to trouble shoot than a software one!
Chris |
Indeed but the whole point of a uC is to cut down on the discrete components thus shifting all the hardware complexity and cost to a software problem...
_________________ Regards,
Laurent
-----------
Here's my first visual theme for the CCS C Compiler. Enjoy! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Sat Mar 14, 2015 10:28 am |
|
|
The problem with the OR gate approach, is you still need the signals connected to the processor, if you are going to know which input has triggered the event....
If you didn't need this, then saving the pins might well be worthwhile. Though the key ability of the processor is to do a lot of jobs, often the limiting factor is the number of pins available, and using a small amount of external logic to save pins is in many cases the best solution. |
|
|
|