Page 1 of 1

Multiple interupts at a time: good idea or not?

Posted: Mon Aug 19, 2019 5:10 pm
by MJU
Is it a good idea to use multiple interrupts in one project?

- I want to use a timer for longer periods (1 minute) and want to accomplish this with a timer interrupt.
- I need an interrupt on a UART RX change
- I want one on a IO port change
- And I think I would need another one.

Is it a good idea to use more than one interrupt?

Some of the interrupts would be disabled in the flowchart and enabled later on.
Is that a good idea, enable and disable them while the program is running?
Or is this a recipe for problems?

So two questions:
- Multiple interrupts in one program: good idea?
- Enable/disable interrupts on the fly: good idea?

Re: Multiple interupts at a time: good idea or not?

Posted: Tue Aug 20, 2019 10:16 am
by Benj
Hello,

As with most things the answer is it's complicated. However yes in most cases multiple interrupts and disabling / re-enabling interrupts is absolutely fine.

The one thing you can't do is change the macro assigned to a specific interrupt. We have a compile error message in place should you try to do this.

Re: Multiple interupts at a time: good idea or not?

Posted: Tue Aug 20, 2019 12:25 pm
by celebriums
Dear Ben,
Greetings to everyone from Turkey.
I hope you are fine.


I often have problems with this.

Problem 1
The 2nd interrupt does not work on most 8-bit processors (except the PIC18 family).!!!!
I am setting the OSC Tune correctly. If OSC Tune is not set, no function is already running.

A non-functioning Interrupt is usually a UART Interrupt.

HS, XT crystal necessarily have to use.
but Correct working condition of 2 interrupts,
(Reading the UART should definitely be inside the Main While Cycle !!!!!)   



2. Problem
For 8-bit processors, if Internal oscillator is selected; UART is not working correctly.
I've had problems recently.
I am setting the OSC Tune correctly. If OSC Tune is not set, no function is already running.
Correct working condition of 2 interrupts,

When 20 Mhz (HS) fundemental crystals were used, everything returned to normal.
(Reading the UART should definitely be inside the Main While Cycle !!!!!)



3. Problem
16 and 32-bit processors;
UART and TMR Interrupti are working at the same time,
Everything is normal and stable in EC, HS and XT.
You can easily use more than one interrupt.
But
I am doing Time Management with TMR,
I always calculate the length of the process step.
Otherwise, problems may occur.
Especially for CANBUS, RS485 and UART


However, if INT OSC is selected, it does not work!!!!


I don't think these problems are caused by the processor.

Re: Multiple interupts at a time: good idea or not?

Posted: Tue Aug 20, 2019 2:07 pm
by chipfryer27
Hi Sadik

I often use 8-bit PICs running on Internal Oscillator and the UART component without issue (typically Baud of 9600). Normally I have the RxInt enabled that branches to a macro that then reads the UART and fills a Circular Buffer. Processing of the CB is done in the Main Loop as-and-when.

I also have multiple interrupts running concurrently (in most cases IOC on pin(s)) without too much issue. Certain chips can prioritise interrupts but if a chip cannot and there is a danger of interrupts conflicting, it is a simple matter to disable interrupts as the first step in your interrupt handling macro and then re-enable once complete.

Hope this is of interest.

Re: Multiple interupts at a time: good idea or not?

Posted: Tue Aug 20, 2019 11:59 pm
by MJU
Thanks BenJ

Re: Multiple interupts at a time: good idea or not?

Posted: Sat Aug 24, 2019 11:57 am
by celebriums
Hello chipfryer27
Thanks for messages.

Using INT OSC with the PIC18F series, you can communicate with 9600 baudrate in UART communication.
This is true, but;
At 19200, 38400 and higher, have you experimented?


chipfryer27 wrote:Hi Sadik

I often use 8-bit PICs running on Internal Oscillator and the UART component without issue (typically Baud of 9600). Normally I have the RxInt enabled that branches to a macro that then reads the UART and fills a Circular Buffer. Processing of the CB is done in the Main Loop as-and-when.

I also have multiple interrupts running concurrently (in most cases IOC on pin(s)) without too much issue. Certain chips can prioritise interrupts but if a chip cannot and there is a danger of interrupts conflicting, it is a simple matter to disable interrupts as the first step in your interrupt handling macro and then re-enable once complete.

Hope this is of interest.

Re: Multiple interupts at a time: good idea or not?

Posted: Sat Aug 24, 2019 12:28 pm
by chipfryer27
Hi Sadik

I've only used 115200 over a very short distance (a couple of cm) and mainly to change the default rate of the device down to 9600 using "AT's". I simply don't need anything faster. I can imagine though that you may need to "tune" the oscillator for higher speeds and there are posts regarding this in the forum.

Now you have my interest piqued and when I'm back I will probably experiment with higher speeds "just because" :)

I have some fun times ahead :)

Regards

Re: Multiple interupts at a time: good idea or not?

Posted: Tue Aug 27, 2019 2:22 pm
by celebriums
Hello All

Greetings

Waiting for the results.

Re: Multiple interupts at a time: good idea or not?

Posted: Tue Aug 27, 2019 2:53 pm
by chipfryer27
Hi Sadik

I travel a lot but so looking forward to experimenting with this. Never having a real "need for speed" the issue of Int Osc has never came up in my snail paced world.

I will update the post with the results of my tinkering :)

Might be a week or two though.

Regards