Hello,
I've been trying to figure out how to build a midi shield with a 16f876. I'd like to use midi messages to control servos and lights, and control sounds from the pic, via the midi protocol. I just found the hardware section on Tom Igoe's page, and it works fine for the midiout, but receiving midi looks more tricky. I've been interfacing successfully with pure data via a midi to usb interface. Pure data receives the bytes perfectly with either hserout and serout2 methods. But when I try to receive midi bytes from pure data and to send them again from the pic, it looks like the datas are not correct.

here is the code:
16f876@20mhz, using mecanique bootloader. Oscillator looks ok

define loader_used 1
define osc 20
define HSER_RCSTA 90h
define HSER_TXSTA 24H
define HSER_BAUD 31250

adcon1=7
include "modedefs.bas"
trisb=0
control var byte
pitch var byte
streng var byte

main:
hserin [control,pitch,streng]
hserout [$90,pitch,streng]

'serin2 portc.0,12,[control,pitch,streng] the other method
'serout2 portc.0,12,[$90,pitch,streng]

goto main


With both methods, the pic seems to loose datas, or clock pace. I just don't understand what's going wrong.
If anyone has any idea, I would be very interested in understanding why sending midi is so easy as receiving it looks so difficult !
Thank you for any reply.