[sdiy] MIDI I/O c code..

Tom Wiltshire tom at electricdruid.net
Fri Mar 20 16:53:22 CET 2020

> On 20 Mar 2020, at 15:13, René Schmitz <synth at schmitzbits.de> wrote:
> On 20.03.2020 15:55, Jean-Pierre Desrochers wrote:
>> Here is my complete interrupt routine,
>> This routine could be called by the USART, Timer0 or Timer1
>> And so reacts on which is calling..
>> Problem doing that ?
> Would use seperate ISRs, so I'm not an expert on this.
> (I'd check: When do the flags get cleared? Could there be race conditions?)

There’s no “separate” interrupt routine on the basic PICs. Any interrupt causes a jump to the same place, so it’s up to the interrupt routine to check which interrupt has occurred, assuming more than one is enabled.

And that’s the clue - "if more than one is enabled”. I’d have *only* the UART Rx interrupt enabled, and then you know when the interrupt occurs exactly what is going on without having to check.

In the main code, you can poll the TMR1IF flag to see if the timer has timed out and then run the processing routine if it has - no need to have an interrupt for that.


More information about the Synth-diy mailing list