PDA

View Full Version : Programmatically generate a (false) interrupt?



circuitpro
- 28th January 2011, 23:10
I've been around long enough to know a dumb question when I see it, and I'm pretty sure this is one.... but here goes.

I've got a some hardware connected to a PIC board that can generate an interrupt (DT_INT0) if different hardware alarm conditions exist. When the board is first powered up, however, no alarm conditions are reported until the first (real) interrupt happens, because nothing has actually generated an interrupt since power up. So... I need to programmatically generate an INT0 on power-up to report any alarm conditions that already exist.

How do you do that? I tried a GOSUB to the INT0 handler, and it didn't error, but also didn't work.

HenrikOlsson
- 28th January 2011, 23:44
Hi,
What "type" of interrupt are you using? ON INTERRUPT, DT-INTS or "true" ASM interrupts?

By the sound of it you're using DT-INTS in which case my guess is that you can't GOSUB to the handler because the handler doesn't end with a corresponding RETURN (the @ INT_RETURN is not the same thing as a "normal" RETURN) which makes the PIC go off to la-la land.

Have you tried, after enabling the interrupts, to simply write to the corresponding interrupt flag bit? I've never tried it my self but I can't se why that wouldn't trip the interrupt. For INT0, simply try INTCON.1 = 1

/Henrik.

circuitpro
- 28th January 2011, 23:48
That works perfectly! Thank you.