The PIC is particularly well-suited for doing MIDI, since most in that family contain a hardware serial module. Just set it for 31.25 kHz and away you go! In this exercise we'll demonstrate how to do MIDI output.
Being a multi-drop protocol, there can be an awful lot of data traveling up and down the bus, depending of course on how many devices you have connected. For that reason, we really need to run the PIC on a speedy clock. For this exercise, I went with 20 MHz, using a ceramic resonator. That's pretty much the max for the PIC16F88, but works quite well. You might take a peek at the compiler constants in the source code to see how PMP is alerted to the new clock source.
Here's the circuit:
It's a simple demo: the keypad indicates one of the 12 notes, beginning with middle C, causing the PIC to send the appropriate Note-ON and Note-OFF data on the MIDI bus. For an initial test, it's pleasant to monitor this data on a laptop. Here's how to set that up. First, you'll plug in a USB-to-MIDI cable; this is plainly visible in the photo, above. This then goes to the laptop which is running some sort of MIDI monitoring software. I think the best is MIDI-OX. And it's free of charge for hobbyist use, but welcomes donations.
Now when you press the keys, MIDI-OX indicates what the notes are and whether turned on or off. A sample run looks like this, where I have just played the diatonic scale:
But the real proof is whether it works decently with a musical instrument. So, see the following demo:
If you're wondering about the GM Voice unit being controlled here, check out my complete plans in:
Click to get the source code.
Click to get the schematic PDF.
Next Project: MIDI -- Input Demo