[sdiy] Organisation of tasks in synth's main uP

Ingo Debus igg.debus at t-online.de
Mon Nov 22 18:20:10 CET 2010


Am 22.11.2010 um 17:29 schrieb Tom Wiltshire:

> Other tasks are slow, but require fairly swift attention. For  
> example, I could buffer MIDI information coming in, and then deal  
> with it in quite large chunks (say 16 or 32 bytes), but this would  
> entail a considerable MIDI lag, which I'd like to avoid. Instead,  
> I'd thought of calling the MIDI parser each time a status byte  
> arrives. This would mean that the previous message was now complete  
> and could be processed, or that a system realtime message had just  
> arrived, in which case it could be processed.

In all my projects I'm using a MIDI input ring buffer. When the UART  
receives a MIDI byte, an interrupt routine puts it just to the ring  
buffer and increnets the write pointer. The MIDI data are parsed in  
the main program. The main program gets aware of received MIDI data  
by comparing the read and the write pointers. If they're not equal,  
the main program grabs the MIDI byte off the ring buffer and  
increments the read pointer. This way the data are not processed in  
larger chunks, still no data are lost even if the main program is  
busy with other things for a while (unless the ring buffer is too  
small).

Ingo



More information about the Synth-diy mailing list