[comp.sys.cbm] MIDI interface for C-64: schematic

prindle@NADC.ARPA (Frank Prindle) (07/31/89)

Here is the C-64 MIDI interface schematic I promised.  I've proofread it as
much as possible; there is always the possibility of a typo remaining, but
I think not.
-------------CUT HERE FOR PRINTING - NEXT 66 LINES SHOULD BE ON 1 PAGE---------
               ____                     COMMODORE 64 MIDI INTERFACE (5 CHIP)
              |xtal|                    Compatible with Siel/JMS(Jellinghaus)
   *----------|-||-|----------*         standard.  Complete on this page.
   |      2Mhz|____|          |
   |                          |         Pages that follow discuss addressing of
   *--\/\/\--*      *--\/\/\--*         6850 chip, MIDI-THRU addition, mods for
   |    2.2K |      |    2.2K |         Sequential or Passport compatibility.
   |  |\     |      |  |\     |  |\
   |  | \    |  ||  |  | \    |  | \
   *--|  >o--*--||--*--|  >o--*--|  >o--------*----*   +5V
      | /   51pf||     | /       | /          |    |    v
      |/               |/        |/         Rx|  Tx|    |
                                           CLK| CLK| Vcc|
                +5V>-----*----\/\/\---*     .--------------.
                         |     270    |     | 3    4   12  | ___    ___
MIDI-IN DIN Jack     .-------.        |     |             7|-IRQ--->IRQ (pin 4)
 5<>--------------*--|2  6   |        |     |              |
                  |  |      4|--------*--Rx-|2           10|-CS1--->A2  (pin W)
 2<>--N/C   diode V  |  PC-  |          DATA|              |
                 --- |  900  |              |            11|-RS---->A0  (pin Y)
            220   |  |      5|------*       |              |   _
 4<>-------\/\/\--*--|1      |      |       |            13|-R/W--->A1  (pin X)
                     '-------'      V       |     6850     |
                                   GND      |     ACIA   14|-E----->02  (pin E)
                      /|       /|           |              |
MIDI-OUT DIN Jack    / |      / |           |            15|-D7---->D7 (pin 14)
 5<>----\/\/\------o<  |----o<  |--------Tx-|6           16|-D6---->D6 (pin 15)
         220         \ |      \ |       DATA|            17|-D5---->D5 (pin 16)
 2<>---*              \|       \|           |            18|-D4---->D4 (pin 17)
       |                                    |            19|-D3---->D3 (pin 18)
       V                                    |            20|-D2---->D2 (pin 19)
      GND   220                 |\          |            21|-D1---->D1 (pin 20)
 4<>-------\/\/\---<+5V         | \         |            22|-D0---->D0 (pin 21)
                            *---|  >o---CS0-|8             |
                            |   | /         |  1 5 9 23 24 |
        |\                  |   |/          '--------------'
        | \             |   |                  | | | |   |
A6 <----|  >o-----------|2  |                  *-*-*-*---*-------*
(Pin S) | /             |   |                    _ _ _  ___      |
        |/   |\         |   |                  V R C D  CTS      V
             | \        |   |                  s T S C          GND
A5 <---------|  >o------|1  |                  s S 2 D    
(Pin T)      | /        |   |       
        |\   |/         |   *-----* 
        | \             |--_      | 
A4 <----|  >o-----------|3  \     |    NOTES:
(Pin U) | /             | 74 \    |          
        |/   |\         |LS30 |o--*    1. All inverter/buffers are (1/6)74LS366
             | \        |    /            with pins 1, 8, and 15 grounded; pin 
A3 <---------|  >o------|12 /             16 supplied with +5V. 2 chips needed.
(Pin V)      | /        |---             
        |\   |/         |              2. A .01 uf bypass capacitor from Vcc to
___     | \             |                 GND at each chip is not a bad idea.
IO1<----|  >o-----------|11         
(Pin 7) | /             |              3. I'm not entirely sure about the 51pf
        |/  +5V         |                 capacitor in the clock circuit; it
             ^      *---|4                may need a different value to oscil-
             |      |   |                 late depending on the crystal used.
+5V<---------*------*---|5
(Pin 2)             |   |              4. The PC900 optoisolator available from
                    *---|6                MIX Bookshelf, 6400 Hollis St. #12,
            GND     |   |                 Emeryville, CA 94608; price is $3.00
             ^      *---|14(Vcc)          including postage.
             |          |
GND<---------*----------|7 (GND)       5. All (Pin #) numbers refer to the C64
(Pin 1)                 |                 cartridge port connector CN6.



To add a MIDI-THRU output jack, it will be necessary to add another 74LS366
chip, since two more inverters are required.  Simply connect the output from
pin 4 of the PC900 optoisolator to the following circuit in addition to pin
2 of the 6850:
                                                    
                      /|       /|    
MIDI-THRU DIN Jack   / |      / |    
 5<>----\/\/\------o<  |----o<  |--------- from pin 4 of PC900
         220         \ |      \ |
 2<>---*              \|       \|
       |
       V
      GND   220
 4<>-------\/\/\---<+5V


A 6N138 optoisolator is the only acceptable substitute for the PC900.  Its pin-
out is different:
                      PC900 Pin         Corresponding 6N138 Pin
                         1                         2
                         2                         3
                         4                         6
                         5                         5
                         6                         8

As shown in the main schematic, the 6850 is addressible in the C-64 I/O
address space $DE04-$DE07 and is clocked at 2MHz.  This is the Siel/JMS
standard.  The following table shows the addressible 6850 registers and control
register settings for the 3 common standards:

                                 Siel/JMS      Passport     Sequential
 Control Register Address          DE04          DE08          DE00
 Transmit Data Register Address    DE05          DE09          DE01
 Status Register Address           DE06          DE08          DE02
 Receive Data Register Address     DE07          DE09          DE03
 Master Chip Reset Command          03            03            03
 Enable Xmit/Rcv                    16            15            15
 Enable Xmit/Rcv + Rcv Interrupt    96            95            95
 Enable Xmit/Rcv + Xmit Interrupt   36            35            35
 Enable Xmit/Rcv + Both Interrupts  B6            B5            B5

Please consult the Motorola MC6850 Data Sheets for details on programming the
6850.  As you can see, all three interface standards are very similar.  The
only two differences are:
                                        _
 1. The way the address lines and the R/W line from the C-64 are decoded.

 2. The 6850 clock frequency - in the Siel/JMS standard it is 2Mhz, in the
    others it is 500KHz.  Therefore, for the Siel/JMS standard, the 6850 must
    be commanded to divide the clock by 64 to achieve the MIDI bit-rate of
    31250; but the Passport and Sequential standards only require it to divide
    by 16; thus the difference in the low 2 command bits.

Any software package may be compatible with one or more of the common stand-
ards; if it is not inherently compatible, either s/w or h/w must be modified.
Therefore, I propose the following (unconfirmed) modifications to the circuit
for compatibility with Passport or Sequential standards.

Passport:

 1. Connect pin 10 of the 6850 (CS1) to A3 (Pin V) instead of A2 (Pin W).

 2. Connect A2 (Pin W) to the inverter input which had come from A3 (Pin V).
                                  _       _
 3. Connect pin 13 of the 6850 (R/W) to R/W (Pin 5) instead of A1 (Pin X).
                               ___
 4. Connect pin 9 of the 6850 (CS2) to A1 (Pin X) instead of GND.

 5. Disconnect the 6850 clock inputs at pins 3 and 4 and insert a divide-by-4
    circuit between the last clock inverter output and pins 3/4.  An example
    of such a circuit is:

                       \        .---------.
                        \       |       14|----< +5V
                         >o-----|11       |
                        /       | 74LS293 |
                       /    *---|12      4|--------*----*
                            |   |    7    |        |    |
                            V   '---------'      Rx|  Tx|
                           GND       |          CLK| CLK|
                                     V          .-----------
                                    GND         |  3    4


Sequential:

 1. Connect pin 10 of the 6850 (CS1) to pin 8 of the same chip (CS2) instead of
    to A2 (Pin W).  This parallels CS1 and CS2.
                               ___
 2. Connect pin 9 of the 6850 (CS2) to A2 (Pin W) instead of GND.

 3. Add the same divide by 4 clock circuit as shown above for Passport.


One final note: any software package which uses the "smart" features of a
specific interface (i.e. it's on-board clock(s), tape/drum sync, foot switch
interfaces, etc.) will probably not work unmodified with this simple MIDI
(UART only) interface.  However, a vast majority of public-domain S/W will
work fine as long as the standard supported is one of the 3 above and the
hardware or the software is modified to match.  Also beware that the Siel/JMS
standard (also DATEL) is the LEAST likely to be supported by software in
the U.S. (Passport is perhaps the MOST supported, with Sequential running a
close second).

Sincerely,
Frank Prindle
Prindle@NADC.arpa

scott@max.acs.washington.edu (08/02/89)

In article <POSTNEWS24024@NADC.ARPA>, prindle@NADC.ARPA (Frank Prindle) writes:
> Here is the C-64 MIDI interface schematic I promised.  I've proofread it as
> much as possible; there is always the possibility of a typo remaining, but
> I think not.
> hardware or the software is modified to match.  Also beware that the Siel/JMS
> standard (also DATEL) is the LEAST likely to be supported by software in
> the U.S. (Passport is perhaps the MOST supported, with Sequential running a
> close second).
 
                "           "
                "           "
                "           "
                "           "
                "           "
 
> Sincerely,
> Frank Prindle
> Prindle@NADC.arpa
 
 
Thanks for the Schematics......It must have taken you a lot of time;   
the MIDI schematic that you drew was very impressive. I appreciated very
much.
 
 
Scott K. Stephen