> > Set a flag to true (MIDI system can send data). > > > Then, when you want to send data through the MIDI, check the flag. If > > true, set it to false and then OUT to the MIDI port. If false, wait > > until it's true (spinlock, or alternatively, just HALT). > > > In your interrupt driver, when you get a MIDI OUT interrupt, set the > > flag to TRUE. > > The point is that (a) the MIDI OUT interrupt is quite difficult to catch > if there are line and frame interrupts going on as well because you coul > easily miss one while the interrupts are disabled; and (b) you don't need > that flag because in(248) already contains one (bit 1). > > imc >
Thanks Ian, you beat be to it there. My interrupt handler works like this at the minute... At the start of the routine it checks STAT in a loop until any signals have ceased then re-enables interrupts straight away. This way a MIDI OUT int can occur at exactly the same time as a FRAME or LINE, or overlap by just a few T's, and one of the checks of STAT should catch it. Also, due to the problem that my MIDI ints don't seem to last very long (honest!) if the initial read of STAT reveals no int signals present, a MIDI OUT int is assumed (this means there should be nothing plugged in to the MIDI IN port, to avoid upsetting things!). This now seems to work and has stopped the chain of MIDI OUTs being lost. David Laundon.

