![]() | MIDI Organ Interface Project |
|
| Below are the two modules for the MIDI Organ system. | |||||
|---|---|---|---|---|---|
| Keyboard Scanner | Stop Switch Scanner | ||||
![]() |
![]() |
||||
|
|
||||
|
| ||||
| High-Speed Serial Messages (9 bits each) | |
|---|---|
| Serial Port | The bit order is determined by the Serial Port Hardware. The standard PIC USART sends a start bit followed by the data bits starting with the LSB, ending with a Stop bit. The following messages are thus transmitted reversing the order of the bits to make the LSB first. |
| Note ON | 1(On) n(msb) n n n n n n(lsb) nnnnnnn is the note number starting at 1 |
| Note OFF | 0(Off) n(msb) n n n n n n(lsb) nnnnnnn is the note number starting at 1 |
| All Note OFF | 0(Off) 0(msb) 0 0 0 0 0 0(lsb) Since there is no note number 0, this message is used to produce all notes off. |
| MIDI Connector Wiring | |||
|---|---|---|---|
![]() MIDI Female Panel Connector-view from front |
Pin 4 is positive with respect to pin 5. Pin 2 is grounded for the MIDI Out, but apparently not for the MIDI In. Logic '1' is no current (Pin 4 and Pin 5 at same voltage), Logic '0' produces current (for 5V Systems, +5V is connected to pin 4 through a 220 ohm resistor, 0V is connected to pin 5 through another 220 ohm resistor. | ||
| Midi Messages | |||
|---|---|---|---|
| Logic Levels and Bit Order |
The message stream transmits at 31.25 kBaud, 32 microseconds per bit, or 320 microseconds per byte Logic '0' is current on Each message byte consists of a start bit (logic 0), 8 data bits (b0 first through b7), and a stop bit (logic 1) | ||
| Channel Numbers |
Channels 1 through 16 actually correspond to indexes 0 through 15 (i.e. channel 1 are bits "0 0 0 0" and channel 15 are bits "1 1 1 1") | ||
|
Each message consists of a status byte followed by 1 or more data bytes B7 of the status byte is always logic '1' B7 of any other byte is always logic '0' Middle C parameter value is 60 (0x3C) Non-velocity device should use a velocity of 64 (0x40) | |||
| Status Byte | 1st Data Byte | 2nd Data Byte | |
| Note ON Event | 1 0 0 1 c(msb) c c c(lsb) cccc is the channel number |
0 n(msb) n n n n n n(lsb) nnnnnnn is the note number |
0 v(msb) v v v v v v(lsb) vvvvvvv is the velocity |
| Note OFF Event | 1 0 0 0 c(msb) c c c(lsb) cccc is the channel number |
0 n(msb) n n n n n n(lsb) nnnnnnn is the note number |
0 v(msb) v v v v v v(lsb) vvvvvvv is the velocity |
| PANIC ALL Notes OFF | 1 0 1 1 c(msb) c c c(lsb) cccc is the channel number |
0 n(msb) n n n n n n(lsb) nnnnnnn is the value 123(decimal) |
0 0 0 0 0 0 0 0 |
| Sustain ON | 1 0 1 1 c(msb) c c c(lsb) cccc is the channel number |
0 1 0 0 0 0 0 0 64 decimal or 0x40 hex |
0 v(msb) v v v v v v(lsb) v is any value > 64 |
| Sustain OFF | 1 0 1 1 c(msb) c c c(lsb) cccc is the channel number |
0 1 0 0 0 0 0 0 64 decimal or 0x40 hex |
0 v(msb) v v v v v v(lsb) v is any value < 63 |
| Reminder | The first byte of a Sustain OFF on Channel 2 (1 0 1 1 0 0 0 1) will appear as "0 (start) 1 0 0 0 1 1 0 1 1 (stop)" | ||