The whole code is above! It was just a few lines before things started going awry...
For everybody's info (and thanking you all again for your input), I transferred over to a 18F4550, which is total overkill for the MIDI project, but I had a couple lying around with future projects in mind.
Result: Works perfectly every time! Button press on a porta pin calls hserout, and the MIDI analyser never shows an error, just the expected leds lighting up according to note on, control change, etc...
So I'm now sticking with a sledgehammer to crack a nut - at least the sledgehammer works! I have no idea why the 16F628A is failing in this respect, and I shall avoid this particular chip for MIDI, but at least I now have a working prototype. Thanks again.
G
Bookmarks