View previous topic :: View next topic |
Author |
Message |
x_berzerker
Joined: 25 Mar 2008 Posts: 2
|
individual isr for each ioc pin |
Posted: Tue Mar 25, 2008 3:52 pm |
|
|
hi everyone!
i'll try to be direct:
i need something like
#int_rb0
void rb0_change () { ... }
#int_rb1
void rb1_change () { ... }
but since this is not implemented (the preprocessor directives does not exists) i would like to know some hints about a better alternative for this situation.
im working on a high time precision application, so im trying to avoid checking which pin triggered the interrupt. any help would be useful. |
|
|
Ttelmah Guest
|
|
Posted: Tue Mar 25, 2008 4:05 pm |
|
|
You have to either check the pins, or use the separate hardware interrupts (depending on the processor involved). The answer is not magic, and there is no magic solution, you need to look at the chip's data sheets, and find one that offers what you want.
A lot of the later 18F chips, have three separate interrupts, as well as the generic 'change' interrupt. However these are edge triggered in one direction, not 'change' sensitive. You can simulate a 'change' function, by reprogramming the active direction in the handler.
Seriously though, testing the pins, only involves a couple of instructions. Given that the overhead of the handler itself is typically over 50 instructions, this is minor.
Other thoughts. You can use the CCP interrupts, as two more interrupts. Again only on one edge though.
Best Wishes |
|
|
RLScott
Joined: 10 Jul 2007 Posts: 465
|
Re: individual isr for each ioc pin |
Posted: Tue Mar 25, 2008 4:30 pm |
|
|
x_berzerker wrote: | hi everyone!
i'll try to be direct:
i need something like
#int_rb0
void rb0_change () { ... }
#int_rb1
void rb1_change () { ... }
but since this is not implemented (the preprocessor directives does not exists) i would like to know some hints about a better alternative for this situation.
im working on a high time precision application, so im trying to avoid checking which pin triggered the interrupt. any help would be useful. |
Don't confuse precision with latency. It is possible to carefully figure out exactly how many cycles it will take to determine that a particular pin has caused an interrupt. You will still know exactly when that pin changed state. It just may be 27 cycles later by the time you figure it out.
Robert Scott
Real-Time Specialties |
|
|
x_berzerker
Joined: 25 Mar 2008 Posts: 2
|
|
Posted: Tue Mar 25, 2008 4:35 pm |
|
|
i forgot to mention it. im using 16F886.
unfortunately, apparently the things cant be more direct than checking the trigger pins. |
|
|
|