MIDI is serial data 8bit, no parity, one stop at 31.250KHz (ie, 1MHz divided by 32). Input is via opto isolation. See
mdfs.net/midi for examples. MIDI protocol sends commands with b7 set and data with b7 clear, commands can be omitted and data bytes will be interpreted according to the last command byte sent. Notes values are semitones, 60=middle C, 62=middle D, etc.
80,note,velocity - Note Off
90,note,velocity - Note On, 60=mid.C
A0,note,velocity - Note Aftertouch, 60=mid.C
B0,control,setting - Control Change
C0,program - Program Change
D0,note,velocity - Channel After-touch
E0,bend.lo,bend.hi - Pitch Wheel Change
F0 - System Exclusive
F1 - undefined
F2 - Song Position Pointer
F3 - Song Select
F4 - undefined
F5 - undefined
F6 - Tune Request
F7 - End Of Exclusive
F8 - Timing Clock
F9 - undefined
FA - Start
FB - undefined
FC - Stop
FD - undefined
FE - Active Sensing
FF - Reset