Page 1 of 1
Multiple interrupts?
Posted: Wed Oct 26, 2011 5:22 pm
by Creative25
Hi to all and thanks for your help.
I am a new user and do not know much about programming yet.
I have currently a program with two interrupts one for the 7 segment LED display and one for a counter for timing functions.
Flowcode gives me an error message saying that I am using multiple asynchronous tasks.
Is that because I use two interrupts at the same time?
The other question I have is this, should I rather multiplex one Interrupt using a counter and a switch and put all the functions into that one Interrrupt? What is the better way of doing it?
Best Regards:
Uli
Re: Multiple interrupts?
Posted: Thu Oct 27, 2011 8:49 am
by Steve
If you search the forum for the term "asynchronous", you'll find that this is a common programming problem.
Basically, it means that you are doing some relatively 'heavy' tasks within your interrupt service routines (ISR) which has the potential to cause your program to behave erratically. By 'heavy task', I mean things like using a 'delay' icon, performing division or float arithmetic, and calling another macro (user or component).
It is good programming practice to keep your ISR as short and simple as possible. Often, you will simply increment a counter or set a global variable to a particular value. Additional processing of this counter or variable should be done within your main program loop.
I hope this helps.
Re: Multiple interrupts?
Posted: Thu Oct 27, 2011 3:03 pm
by Creative25
Hi Steve,
Thanks for your Info.
You answered the first half of my question.
It probably means the interrupt is too long.
I removed the calculation for the Minus point from the Interrupt macro and put it in a separate macro wich is called from the main program. Now there is no error message.
The macro has to be called in each loop where temperature settings are changed or temperature is measured. In total seven times.
Is there an easyer way of doing it?
How about multiplexing an interrupt, instead of having two interrupts? The first round it has one task the second another task etc.
What is better, to use one interrupt multiplexed, or to use two separate interrupts?
Best Regards:
Uli
Re: Multiple interrupts?
Posted: Thu Oct 27, 2011 3:11 pm
by Steve
It is difficult to answer your questions without fully understanding your program. But I don't have the time to help to this level of detail.