Searching \ for '[PIC] Interfacing PIC to MIDI' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Interfacing PIC to MIDI'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Interfacing PIC to MIDI'
2008\07\23@130237 by Al Young

picon face
For anyone with experience with PIC-to-MIDI interfacing:

I'm working a design, using a PIC18F1320, to interface a 61-note (organ)
keyboard to MIDI.
Looking at the MIDI interface, it appears to me that the idle state of the
PIC's (USART TX) output should be +5V and that a data 1 should be 0V.
Yet, in looking around at sample circuits on the web, I find most simply
connect TX directly to a MIDI-In port, without an inverter.

So, my question: will I need to invert the TX output, or is there something
that I'm missing?

Thanks,

Al Young
Phoenix USA


2008\07\23@140032 by Bob Blick

face
flavicon
face
Hi Al,




On Wed, 23 Jul 2008 10:02:12 -0700, "Al Young" <spam_OUTa.r.youngTakeThisOuTspamcox.net> said:
{Quote hidden}

--
http://www.fastmail.fm - mmm... Fastmail...

2008\07\23@141606 by Bob Blick

face
flavicon
face
oops, webmail attacked my previous reply.

Hi Al,

MIDI is supposed to be an optoisolated current loop. The optoisolator is
on the receive end. So if you are doing the transmit end you don't need
any parts other than a resistor from positive going out and another from
your PIC TX pin going out.

Cheerful regards,

Bob


On Wed, 23 Jul 2008 10:02:12 -0700, "Al Young" <.....a.r.youngKILLspamspam@spam@cox.net> said:
{Quote hidden}

--
http://www.fastmail.fm - And now for something completely different…

2008\07\23@160746 by Al Young

picon face
Thanks, Bob, for the quick reply.

I'm still missing something, so let me try your patience and be more
specific.
Here's my understanding of the MIDI wiring.

For the MIDI Out connector:
- The TX pin, connects through a 220-ohm resistor, to pin-5;
- Pin-2 of the connector is connected to ground;
- +5V, through a 220-ohm resistor, connects to pin-4 of the Out connector.

At the receive end:
- pin-5 connects to the cathode of the opto's LED, and;
- pin-4 connects, through another 220-ohm resistor, to the anode of the
opto's LED.

Essentially, the LED is pulled up by the 3, 220-ohm resistors.
To me, that means that a 0, or idle, should be +5V on the TX pin so the
opto's LED does not light.

Obviously, I'm *assuming* that a lit LED equals a data 1, and that unlit
means 0.
Is this the part that I have backwards?

Many of the examples on the web use a bit-banged "UART" (they use the
16F84), so it would be a simple matter for them to invert the logic.
I'll be using the 1320's USART, and I'd like to get it right the first time.

Thanks for slogging through this.

Al

---------------------------------------------------------

Hi Al,

MIDI is supposed to be an optoisolated current loop. The optoisolator is
on the receive end. So if you are doing the transmit end you don't need
any parts other than a resistor from positive going out and another from
your PIC TX pin going out.

Cheerful regards,

Bob


{Quote hidden}

--


2008\07\23@163429 by Andre Abelian

flavicon
face
Just make it short. For example

http://natrium42.com/wiki/MIDI
www.media.mit.edu/physics/pedagogy/fab/fab_2002/personal_pages/da
vid/mit.edu/midi-schem.jpg


Andre

{Original Message removed}

2008\07\23@164043 by Gerhard Fiedler

picon face
Al Young wrote:

> Obviously, I'm *assuming* that a lit LED equals a data 1, and that unlit
> means 0.
> Is this the part that I have backwards?

I think so.

<crystal.apana.org.au/ghansper/midi_introduction/physical_layer.html>
<http://en.wikipedia.org/wiki/The_MIDI_1.0_Protocol>

Gerhard

2008\07\23@171636 by Al Young

picon face
Thanks guys.  You've set me right.

The key that I was missing is that in the MIDI protocol:  logic-0 ==
current-high; logic-1 == current-low.
The wikipedia link did the trick.

Al

{Original Message removed}

2008\07\23@171803 by Bob Blick

face
flavicon
face

On Wed, 23 Jul 2008 13:07:20 -0700, "Al Young" <a.r.youngspamKILLspamcox.net> said:

> Here's my understanding of the MIDI wiring.
>
> For the MIDI Out connector:
> - The TX pin, connects through a 220-ohm resistor, to pin-5;
> - Pin-2 of the connector is connected to ground;
> - +5V, through a 220-ohm resistor, connects to pin-4 of the Out
> connector.

Yes.

> At the receive end:
> - pin-5 connects to the cathode of the opto's LED, and;
> - pin-4 connects, through another 220-ohm resistor, to the anode of the
> opto's LED.

Yes.

> Essentially, the LED is pulled up by the 3, 220-ohm resistors.
> To me, that means that a 0, or idle, should be +5V on the TX pin so the
> opto's LED does not light.

Almost. MIDI, like RS232, idles at a logical "1", which in MIDI is "no
current flow".

RS232 however has logical "0" at voltage "1" so why RS232 chips invert
the USART signal.

> Obviously, I'm *assuming* that a lit LED equals a data 1, and that unlit
> means 0.
> Is this the part that I have backwards?

Backwards. The USART idles at logical 1 and voltage is at +5 volts. So
with the MIDI wiring you described, all is good and no current flows at
idle.

> Many of the examples on the web use a bit-banged "UART" (they use the
> 16F84), so it would be a simple matter for them to invert the logic.
> I'll be using the 1320's USART, and I'd like to get it right the first
> time.

I think you have it. The receive side is harder because you must use a
proper optoisolator that is fast enough at low MIDI current levels.

> Thanks for slogging through this.

Every time I do something with MIDI I have to remember which is up and
which is down - it was easier this time than last time so I must not be
old yet!

Cheerful regards,

Bob

--
http://www.fastmail.fm - And now for something completely different…

2008\07\23@200155 by Jinx

face picon face
> I think you have it. The receive side is harder because you must use
> a proper optoisolator that is fast enough at low MIDI current levels

A MIDI thing I'm tinkering with specifies a 6N137

http://www.fairchildsemi.com/pf/6N/6N137.html

More... (looser matching)
- Last day of these posts
- In 2008 , 2009 only
- Today
- New search...