Here's an example using serin2, you have to use a 20MHz crystal:
It reads in MIDI data and sends it out to a serial port, worked fine for me.
@ device pic16F628A, pwrt_on, mclr_on, protect_off, wdt_on, HS_OSC
INCLUDE "modedefs.bas"
DEFINE OSC 20
CMCON = 7 ' PortA = digital I/O
PORTA = %00000001
TRISA = %00000000
PORTB = %00000000
TRISB = %00000000
test1 VAR BYTE
test2 VAR BYTE
mdata VAR BYTE
loop:
SerIn2 PORTA.0,12,[test1,test2,mdata]
SerOut PORTB.7,N9600,[" midi : ",#test1," ",#test2," ",#mdata,10,13]
GoTo loop
end
Bookmarks