[sdiy] bizarre pic-midi issues

Colin f colin at colinfraser.com
Sat Apr 17 01:19:02 CEST 2010


Karl,

> BUT if i send
> 0x90 0x33 0x64 (key 33 ON velocity 40)
> i get
> 0x90 0x99 0x64 (key 99 ON velocity 40)
> 
> any odd-number second byte get screwed up.

The MIDI data line's stready state is a 1.
The start bit is a 0, then the data byte comes LSB first.
The stop bit is a 1.
So the stream of bits for 0x33 might look like below.
The characters below show which bits are the actual byte arriving, s for
start and stop, d for data:

111111111101100110011111111
          sddddddddds       
 
Start bit is 0, 11001100 reversed to give you MSB first is 00110011 or 0x33
If you drop the first data bit from that stream, what number do you get ?

11111111110 100110011111111
          s dddddddds

Answer: 10011001, the binary palindrome that is 0x99
This could be because you have the start/stop bit polarity wrong, the baud
rate wrong, or some opto problem giving a poor leading edge on the start
bits that cause the following bits to be read late.

Are you checking the UART staus flags for framing errors on reception ?

Cheers,
Colin f





More information about the Synth-diy mailing list