Interfacing PIC to MIDI

View: New views
11 Messages — Rating Filter:   Alert me  

Interfacing PIC to MIDI

by Al Young-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: Interfacing PIC to MIDI

by Bob Blick-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Al,




On Wed, 23 Jul 2008 10:02:12 -0700, "Al Young" <a.r.young@...> said:

> 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?

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

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: Interfacing PIC to MIDI

by Bob Blick-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.young@...> said:

> 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?

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


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: Interfacing PIC to MIDI

by Al Young-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


> 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?

--


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

RE: Interfacing PIC to MIDI

by Andre Abelian-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just make it short. For example

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


Andre

-----Original Message-----
From: piclist-bounces@... [mailto:piclist-bounces@...] On Behalf
Of Al Young
Sent: Wednesday, July 23, 2008 1:07 PM
To: Microcontroller discussion list - Public.
Subject: Re: [PIC] Interfacing PIC to MIDI

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


> 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?

--


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

IMPORTANT NOTICE: This notice constitutes Proprietary Rights identification of this email including all attachments, which is property that is intended only for the use of the individual or entity to which it is addressed.  It also may contain proprietary data or information that is privileged, confidential, or otherwise protected from disclosure under applicable law.  The recipient of this data agrees to abide by the United States Export Control of Technical Data and Equipment under the International Traffic in Arms Regulations (ITAR) and Export Administration Regulations (EAR).  The recipient agrees to abide by these laws and their regulations not only for export and re-export, but for disclosure to non-U.S. citizens.   This email does not grant or assign rights of ownership in the proprietary subject matter herein, nor shall it be construed as a joint venture, partnership, teaming agreement, or other formal business relationship.  If the reader of this e-mail transmission!
  is not the intended recipient or the employee or agent responsible for delivering the transmission to the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this e-mail or its contents is strictly prohibited.  Please notify the sender you received it in error by responding to the e-mail and then permanently delete it and all copies of the e-mail immediately, including any copies of it in your deleted email folder.


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: Interfacing PIC to MIDI

by Gerhard Fiedler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

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

Gerhard

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: Interfacing PIC to MIDI

by Al Young-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 -----
From: "Gerhard Fiedler" <lists@...>
To: <piclist@...>
Sent: Wednesday, July 23, 2008 1:40 PM
Subject: Re: [PIC] Interfacing PIC to MIDI


> 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.
>
> <http://crystal.apana.org.au/ghansper/midi_introduction/physical_layer.html>
> <http://en.wikipedia.org/wiki/The_MIDI_1.0_Protocol>
>
> Gerhard
>
> --
> http://www.piclist.com PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist
>


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: Interfacing PIC to MIDI

by Bob Blick-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Wed, 23 Jul 2008 13:07:20 -0700, "Al Young" <a.r.young@...> 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Â…


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

16F505 - wont enter debug

by alan smith :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

last time I had an issue, it was a LVP or such configuration bit.  The '505 is so bare bones...internal osc, mclr, wdt....nothing I can see that would prevent it from going into debug.  Anyone have a suggestion?  I'm traveling this week, so hopefully might see an answer today before I hit the road.

It does connect, says it programs, just wont enter the debug mode


     
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: 16F505 - wont enter debug

by David Meiklejohn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

alan smith wrote:
>
> last time I had an issue, it was a LVP or such configuration bit.  The
> '505 is so bare bones...internal osc, mclr, wdt....nothing I can see that
> would prevent it from going into debug.  Anyone have a suggestion?  I'm
> traveling this week, so hopefully might see an answer today before I hit
> the road.
>
> It does connect, says it programs, just wont enter the debug mode

Are you using a debug header?  (16F505-ICD).  You can use an ICSP
programmer (e.g. PICkit 2, ICD2) to program the bare 16F505, but it has no
debug support on chip and so needs the -ICD header.


David Meiklejohn
www.gooligum.com.au

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: Interfacing PIC to MIDI

by Jinx-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 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

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
LightInTheBox - Buy quality products at wholesale price