View previous topic :: View next topic |
Author |
Message |
twibb
Joined: 25 Jan 2007 Posts: 2
|
Artificial Hardware Interrupt |
Posted: Thu Jan 25, 2007 11:30 pm |
|
|
Hi. Forgive my ignorance I'm a PIC & CCS newbie. I've inherited a project based on CCS 3.249 & a PIC16F628A. The PIC has several GPIO lines configured as edge triggered interrupts. The related interrupt service routines are complex but work as expected except at powerup. In some cases the interrupt events are missed as the edge transitions have taken place prior to processor initializatioin & interrupts enabled. There are several paths I can take to resolve the issue but it seems to me one of the easiest & lowest risk ways of resolving the issue is to artificially induce a hardware interrupt after processor inititalization is complete. My questions are: Is this possible? Is it safe? If possible, how?
Thanks in advance. |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Thu Jan 25, 2007 11:45 pm |
|
|
I think you just need to read the port after initializing. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Jan 26, 2007 3:08 am |
|
|
Quote: |
The PIC has several GPIO lines configured as edge triggered interrupts.
|
It will be helpfull to see how did you configure these lines.
Quote: |
The related interrupt service routines are complex but work as expected except at powerup.
|
Adding to Neutone comment: you should disable the interrupts during init, read the
inputs and after this you can enable interrupts.
Anyway if you need better help you would post a code.
Humberto |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Jan 26, 2007 7:01 am |
|
|
If these events occur before the PIC is "up and running" then your best bet is to make sure the PIC comes up first or either past events shouldn't matter. You really don't give enough detail about the hardware and why it is important to handle past events. |
|
|
twibb
Joined: 25 Jan 2007 Posts: 2
|
Artificial Hardware Interrupt |
Posted: Fri Jan 26, 2007 9:16 am |
|
|
Thanks for the input. As I mentioned I inherited this project & I'm still investigating how, what & why it works. Our board interfaces with external hardware that we have no control over. This external hardware generates the interrupt events so I have no control of their timing. As I mentioned the interrupt service routines work as expected after power up is complete & new events are generated. It would seem simple to just poll the I/O pins for state & act accordingly but the I/O interrupts trigger timer interrupts & after timing related decisions are made the main software acts accordingly. Since I didn't write the software I'm looking for a low risk way of fixing the problem without major modification to it's operational theory. If artificially inducing a hardware interrupt isn't possible, simple & safe....I'll pick another path. |
|
|
|