Page 1 of 1

MX008 - Introduction to interrupts

Posted: Fri May 01, 2009 11:51 am
by Sean
Article: http://www.matrixmultimedia.com/article.php?a=55

If you have any questions for the author or comments on the article, please post them below.

Re: Introduction to interrupts

Posted: Sun May 31, 2009 4:03 pm
by jose
Hi Sean,
Thanks for your article!
I have a doubt:
Why in the main program the component LED variable is 0 and why in the tmr0isr the component LED variable is 1?
Thanks
Regards
JosΓ©

Re: Introduction to interrupts

Posted: Mon Jun 01, 2009 3:22 pm
by Sean
Hello JosΓ©

The example programs flashes two LEDs to show the difference between the interrupt controlled and the non-interrupt controlled timers.

Both of the LEDs are from the same multi-LED component, LEDs(0).

The first LED, LED(0), is controlled from the main program loop - (LED On(0), LED Off(0))

The second LED, LED(1), is controlled from the timer interrupt service routine - (LED On(1), LED Off(1))

Re: Introduction to interrupts

Posted: Tue Jun 02, 2009 12:04 am
by jose
Hello Sean,
This was a silly question... sorry
The 0 and 1 are LED position numbers!

Thanks

Re: Introduction to interrupts

Posted: Thu Oct 08, 2009 10:11 pm
by karkamp
Hi im having problem to configure a interrupt in a ECIO40P

Could you please tell me if is that possible and how can i do that!?

Thanks

Regreats!

Re: Introduction to interrupts

Posted: Fri Oct 09, 2009 9:21 am
by Sean
Hello,

Firstly:
Are you testing your interrupt programs on the target hardware, or in simulation?
Are you having problems with a specific interrupt?
Are you writing custom interrupt code?

You should be able to access all of the interrupt sources generated by the PIC18F4455. The ECIO40 is no different to any of the other target devices in this resapect.
Flowcode V3 provides direct support for seven of the more commonly used interrupts (enable, disable, configuration, service routine calls) - Flowcode V4 provides support for additional interrupts. The custom interrupt option provides a Flowcode framework to allow C programmers to gain access to all remaining interrupts not directly supported by Flowcode.

I have downloaded the example programs from this article (written for the PIC16F877A) to an ECIO40 by simply changing the target device in the Chip -> Target menu and compiling to the chip. The TMR0 Overflow interrupt used in the example programs is common to all devices, so the programs run correctly on the ECIO40 when downloaded.

The only change to the operation of the programs is the increased interrupt frequency due to the higher clock speed.

Re: Introduction to interrupts

Posted: Tue Nov 10, 2009 11:15 am
by medelec35
A Tip:
If you want a certain delay or update LCD display after an interrupt has occurred you can do the following:

In the interrupt routine just set a variable eg. called INT_TRIGGER to 1

Then use a decision icon for delay in your main program.
E.g If INT_TRIGGER = 1 then Delay.
Just after delay have INT_TRIGGER = 0
So the delay is not ran until new Interrupt has occurred.

This way the interrupt macro is kept to a minimum, Which should be the ultimate goal!

I found out the hard way you can’t have a delay over a certain value within an interrupt macro.
So best not to have a delay at all!

This may seem obvious to some people, but when you’re first learning the obvious can easily be over looked!