Article: https://www.matrixtsl.com/resources/get ... .php?id=55
If you have any questions for the author or comments on the article, please post them below.
MX008 - Introduction to interrupts
-
- Flowcode V4 User
- Posts: 26
- Joined: Sat Nov 01, 2008 12:11 am
- Has thanked: 7 times
- Been thanked: 10 times
Re: Introduction to interrupts
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Γ©
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Γ©
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: Introduction to interrupts
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))
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
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!
Could you please tell me if is that possible and how can i do that!?
Thanks
Regreats!
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: Introduction to interrupts
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.
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.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Introduction to interrupts
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!
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!
Martin