On Sun, Nov 03, 2002 at 02:40:27PM -0800, Heath Carlisle wrote: > Hello, Listers. This is my first post the list. > > I am looking for information and code examples regarding the transmission of > MIDI data using the Mid-Range PIC's onboard USART. I have sen examples that > "bit-bang" an I/O pin, but it seems that the USART is a better method. > > Any methods, caveats, wisdom or advice from you experienced folks? Absolutely nothing special about it. Your best bet is to take a read of Fr. McGahee's PICUART.ASM document as it's the most complete discussion of the PIC USART around. You simply set the clock frequency and the bit rate to 31250 BPS, and either check for the appropriate flags or build an interrupt routine or two. As for the phsical interface I use the standard interface from Hal Chamberlin's "Musical Applications of Microprocessors" book. MIDI OUT consists of a single 7407 open collector buffer output tied to 220 ohm resistor. The other end of the current loop is simply a 220 ohm resistor to +5. There are a dozen ways of arranging the current loop. All you need to remember is that you want current to flow the the USART output is low and not to flow when the USART output is high. You can use a simple transistor driver or an opamp if you like. In fact the PIC output itself probably can push enough current through to drive it directly. As for MIDI IN, every interface I've ever seen has used an optoisolator. The key thing is to ensure that the slew rate is sufficient to get clean edges. Chamberlin suggested using 6N138 Darlingtons. A sample of such circuits can be found here: http://www.usyd.edu.au/su/anaes/rpa/Loadsmanextras/Macmidi.html I would suggest that you test your interface circuits by creating a MIDI THRU by connecting the output of the optoisolator of the MIDI IN to the input of the buffer for the MIDI OUT. Hook it up between a MIDI keyboard and MIDI module and test it out. You can be sure then that your interface works OK. > > I am programming in assemby language using the MPLAB IDE. I program the > chips using Design Devices Programmer and thier boot-loader enabled 16F877. That should get you set up. MIDI is down on my list of things to do. I'm going to get around to building that MIDI sequence/drum machine that I dreamed up oh so many years ago. With Compact Flash and high speed 18F parts, it should be a piece of cake. If only I could find the time. BAJ -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics