[comp.sys.cbm] MIDI interface for C64 - the final chapter

prindle@NADC.ARPA (Frank Prindle) (08/23/89)

I finished building my triple personality board tonight and tested it in all
three modes. This design, while electrically no different from what I prev-
iously posted, uses a DIP socket to allow selection of the appropriate standard
by simply plugging in jumpers; thus it can easily be changed to emulate any
of the 3 standards. A suitable prototype board with 0.1" edge contacts can be
found at Radio Shack, though it will have to be cut down to 22 pins wide to
fit into the C64/C128 cartridge port. I put mine in an old Commodore cartridge
case with about 1" of board sticking out the back to hold the DIN jacks and
the personality socket. The schematic (exactly 66 lines) and notes follow:

-----------------------------------CUT HERE------------------------------------
               ____ COMMODORE 64 TRI-STANDARD MIDI INTERFACE              
              |xtal|                                       .----------.
   *----------|-||-|----------*         *------------------|11      14|----<+5V
   |      2Mhz|____|          |         |                  |  74LS293 |
   |                          |         |               *--|4   12   7|----*   
   *--\/\/\--*      *--\/\/\--*         |               |  '----------'    |
   |    2.2K |      |    2.2K |         |    15    1    |        |         |
   |  |\     |      |  |\     |  |\     *-----@    @    @        *---------*
   |  | \    |  ||  |  | \    |  | \    |          |   16                  |
   *--|  >o--*--||--*--|  >o--*--|  >o--*     *----*                       V
      | /  500pf||     | /       | /          |    |     *---<+5V         GND
      |/               |/        |/         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------------@14
 2<>--N/C   diode V  |  PC-  |          DATA|              |
                 --- |  900  |              |            11|-RS---->A0  (Pin Y)
            220   |  |      5|------*       |              |   _
 4<>-------\/\/\--*--|1      |      |       |            13|-R/W------------@12
                     '-------'      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             |
                            |   | /   |     | 9   5 1 23 24|
        |\                  |   |/    |     '--------------'
        | \             |   |         @       |   | | |  |
A6 <----|  >o-----------|2  |         4   @---*   *-*-*--*-------*
(Pin S) | /             |   |            11  ___  _   _ ___      |
        |/   |\         |   |                CS2  R V D CTS      V
             | \        |   |                     T s C         GND
A5 <---------|  >o------|1  |                     S s D    
(Pin T)      | /        |   |       
        |\   |/         |   *-----*   
        | \             |--_      |                       6@------->A1 (Pin X)
A4 <----|  >o-----------|3  \     |                                            
(Pin U) | /             | 74 \  8 |                       2@------->A2 (Pin W)
        |/   |\         |LS30 |o--*                                            
             | \        |    /                            3@------->A3 (Pin V) 
 @-----------|  >o------|12 /                                         _        
13           | /        |---                              5@------->R/W (Pin 5)
        |\   |/         |                                                      
___     | \             |                    
IO1<----|  >o-----------|11            NOTES:
(Pin 7) | /             |              1. All inverter/buffers are (1/6)74LS366
        |/  +5V         |                 with pins 1, 8, and 15 grounded; pin
             ^      *---|4                16 supplied with +5V. 2 chips needed.
             |      |   |              2. A .01 uf bypass capacitor from Vcc to
+5V<---------*------*---|5                GND at each chip is not a bad idea.
(Pin 2)             |   |              3. The PC900 optoisolator available from
                    *---|6                MIX Bookshelf, 6400 Hollis St. #12,
        7   GND     |   |                 Emeryville, CA 94608; price $3.00 PP.
        @    ^      *---|14(Vcc)       4. All (Pin #) numbers refer to the C64
        |    |          |                 cartridge port connector CN6.
GND<----*----*----------|7 (GND)       5. All @ symbol numbers refer to pins on
(Pin 1)                 |                 a 16-pin personality select socket.


This interface must be configured for a particular standard by plugging
jumpers (or a jumpered DIP header) into the personality socket.  The jumpers
required for each standard are as follows:

    Passport Standard        Sequential Standard        Siel/JMS Standard
    -----------------        -------------------        -----------------
         1 - 16                    1 - 16                     1 - 15
         3 - 14                    4 - 14                     2 - 14
         2 - 13                    3 - 13                     3 - 13
         5 - 12                    6 - 12                     6 - 12
         6 - 11                    2 - 11                     7 - 11


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.  It is
available from retail parts distributors such as Active Electronics.  Its pin-
out is different:
                      PC900 Pin         Corresponding 6N138 Pin
                         1                         2
                         2                         3
                         4                         6
                         5                         5
                         6                         8

Radio-Shack optoisolators are not an acceptible substitute!

Resist the temptation to ground the outer shell contact of any DIN jack, or
pin 2 of the MIDI-IN DIN jack.  Doing so violates the MIDI standard and can
cause all sorts of ground-loop problems depending on the cables used.  The
MIDI interface sold by DATEL has this flaw.

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
differences are in the frequency of the 6850 clock and the addressing of the
6850 registers.  These differences are summarized in the following table:

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


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 and software standards 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