[sdiy] Tips for writing a MIDI parser wanted
Tom Wiltshire
tom at electricdruid.net
Wed Mar 25 12:24:59 CET 2009
I've sorted this problem. It wasn't (directly) to do with the timing.
Instead it was a quirk of how I'd sent bytes.
It turns out that if you send a byte then wait until it's sent, it
doesn't work correctly, but if you wait until the last byte is sent,
then send the new one, it's fine. Changing the order was enough to
solve the problem.
For the PIC-minded, using TXIF to detect that TXREG is clear is fine,
as long as you do it *before* you put data in. You don't need to wait
until the TSR is empty and the TRMT bit is set.
Thanks again,
Tom
On 24 Mar 2009, at 23:58, Simon Brouwer wrote:
> Tom Wiltshire schreef:
>> One thing I've noticed with the transmit is that it is possible to
>> send bytes from the PIC too quickly - there seems to be a minimum
>> space required between them. Does anyone know how long this pause
>> should be between the transmission of individual MIDI bytes? I can
>> always find a value by trial and error, but that seems a bit
>> uncertain.
> Then you probably don't check the UART transmit register empty flag
> (in the PIC18Fxx20 for example, this is the TRMT bit in the TXSTA
> register)?
> As long as you wait for the transmit register to become empty
> before writing each byte, they will be transmitted correctly.
>
> --
> Vriendelijke groet, Simon Brouwer.
> | http://nl.openoffice.org | http://www.opentaal.org |
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
More information about the Synth-diy
mailing list