Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

MicroMIDI

Article from Electronics & Music Maker, May 1983

Computer control for MIDI-equipped instruments



PARTS COST GUIDE £16.50

★ Serial MIDI link
★ Opto-coupled input
★ Crystal controlled data transfer
★ 3 Parallel I/O ports
★ Single board construction

At last synthesiser manufacturers have come together and agreed on a specification which allows the latest processor-controlled equipment of different origins to be connected together. This system known as the MIDI (Musical Instrument Digital Interface), is implemented by transferring digital information, in serial format, between instruments.

Being digital it is a fairly simple matter to connect a microcomputer into the system and generate or process data relevant to particular instruments.

A detailed introduction to the MIDI is given elsewhere in this issue, so this article will mainly deal with the practical aspects of a computer interface.

To allow other circuitry to be connected into the system a parallel interface with 3 Input/Output ports has also been included.

The interface can be connected directly to any Z80 processor system and selected using IN and OUT instructions. However, the micro buss connections have been configured in a format suitable for direct connection to the Sinclair Spectrum.

Other processor systems such as those using the 6502 could be connected by decoding the address lines and treating the registers as memory locations.

MIDI connections are made to the board using the specified 5 pin DIN sockets.

Serial Data



The MIDI is operated at 31.25 kBaud, each data 'word' containing 10 bits; one start bit, 8 data bits (Do to D7) and one stop bit as shown in Figure 1. Each 'word' therefore takes 320uS to be transmitted. This high transfer rate is necessary to prevent noticeable delays between equipment.

Figure 1. MIDI Serial word format.


In the MicroMIDI the serial conversion is handled by an ACIA (Asynchronous Communications Interface Adaptor) which essentially contains two registers, one for 'transmit' and one for 'receive'. The device is configured to produce a serial 'word' in the required format whenever the transmit register is loaded with data. Conversely, when serial data is detected on the receive input, it is converted and loaded into the receive register. The transfer rate is set by an external clock.

Figure 2. MicroMIDI circuit diagram.
(Click image for higher resolution version)


Circuitry



A complete circuit diagram of the interface is shown in Figure 2. IC2 is the ACIA, which is enabled via IC3 and IC1f. Transmitted data is buffered by IC1d & e and connected to the MIDI OUT socket. Incoming data is connected via an opto-isolator, IC6, which prevents ground loops corrupting the data and protects IC2 from potentially destructive signals. The external 2MHz clock is based around IC1a & b and is squared up by IC1c. This is divided down inside IC2 by either 16 or 64. Dividing by 64 gives the required transfer rate of 31.25KHz.

IC5 is enabled via IC4 and provides the 3 parallel I/O ports. Bit 8 of Port C has a 'user definable' switch connected which could be used as a break switch in machine code programs or to produce some other specific operation.

Decoupling is provided around the circuit by C2, 3 and 4.

Figure 3. PCB component overlay.
(Click image for higher resolution version)


Construction



Assembly should present no great problems as all the parts are mounted on the PCB. Using Figure 3 as a guide, first solder the 21 links into place. Next, locate and solder the resistors, capacitors and diode followed by the IC sockets. Since IC6 has only 6 pins, a cut down 8 pin socket should be used. The crystal, switch and sockets 2-6 can now be fitted. Socket 1 requires a bit of 'fiddling' and care should be taken to make sure that it lies parallel to the surface of the PCB. Firstly, bend the lower row of pins and insert into the board so that the body of the socket butts against the edge of the PCB. The upper row of pins should now be the right length to bend and insert through the board. Socket 1 can be left out if the board is to be used with Z80 systems other than the Sinclair Spectrum.

MicroMIDI connected to the Sinclair Spectrum.


Addressing



Eight registers in all are decoded from the address lines A0-A7. The Spectrum uses A0-A4 internally, so the 3 MSBs are used to select the required register.

The addresses are:

Binary Hex Dec Selection
00011111 1F 31 PORTA
00111111 3F 63 PORT B
01011111 5F 95 PORT C
01111111 7F 127 8255 CONTROL
10011111 9F 159 6850 CONTROL
10111111 BF 191 Transmit Register
11011111 DF 223 6850 STATUS
11111111 FF 255 Receive Register


Testing



The completed MicroMIDI board.

The best way to test the board is to connect a 5 pin DIN lead between the IN and OUT sockets.

After the computer has been switched on the ACIA must be reset. To do this the two LSBs of the control registers should be set. The clock divide is then selected (4-64) and the word length specified by loading the register with OUT 159,86 (56 Hex). A complete definition of the register contents are given in Table 1.

The status register can be read, by printing IN 223. It should contain the value 2 which shows that the Transmit register is empty. Loading the transmit register with any number eg OUT 191, 85 and then reading the Status register should now produce the value 3. This means that data has been transmitted and the receive register is now full. When the receive register is read, IN 255, it should contain the transmitted number 85.

Table 2. Definition of PIO Port control, Mode 0.
Table 1. Definition of ACIA register contents.



Parallel ports can be tested by setting up the control register for the required configuration as shown in Table 2. (Note that Port C can be split into two 4 bit sections which can either be In or Outs). Data can then be read from, or written to, Ports A, B and C using IN and OUT instructions.

Applications



Table 3. Prophet 600 program dump.

A simple program which illustrates the possibilities of the MIDI is shown in Figure 4a. Firstly, the ACIA is reset and configured (lines 10 and 20). A program number is requested (line 30) which is variable 'n'. The number 192 (C0 Hex) is then output to the transmit register which is the code for a program change (see MIDI Data Format), and then the program number, n, is output which will change the program of the instrument connected. Line 60 makes the program jump back to line 30 for another selection. This illustrates how easily voice changes could be incorporated into a sequencer program or a string of voice changes could be stored and stepped with a footpedal.

Figure 4a. Sample program allowing synthesiser program changes.


A second example which demonstrates the exciting possibilities of the MIDI is shown in Figure 4b. This is a machine code routine which waits for a program dump from the Prophet 600 and then converts the incoming data from 32 four bit nibbles into 16 bytes of program data as shown in Table 3. This data could be displayed, edited or printed as required.

Figure 4b. Machine code routine which reads a Prophet 600 program dump into memory.


The routine checks for 240 (System Exclusive Status), then 1 (SCI's ID number) then 2 (Prophet 600 program dump) before loading the program number and program data. When an end of block code, 247, is detected the control returns to the basic monitor. The program number is written into location 32500 followed by 16 bytes of data.

Spectrum, MicroMIDI and Prophet 600 test set-up.

Analogue synthesisers may be added to the system by connecting ADC and DAC convertors to the I/O ports as described in the MicroMusic articles November '82 and January '83.

Synchronising the system from an external clock is also possible using Port C and sending the required System Real Time codes when the relevant edge is detected.

Now that SCI, Roland, Korg, Yamaha and Moog have all agreed to adopt the MIDI we shall no doubt see some interesting software appearing for home computers. Now is the time to join the MIDI revolution.

The PCB for the MicroMIDI is available from E&MM, (Contact Details) at £4.25 inc. VAT and P&P. Please order as: MicroMIDI PCB.

MicroMIDI PARTS LIST

Resistors — all ¼W, 5% carbon film
R1,2 680R
R3 470R
R4,5 100R
R6 1k

Capacitors
C1 1nF polycarbonate
C2 47uF 25V PCB electrolytic
C3,4 100nF polycarbonate

Semiconductors
D1 1N4148
IC1 74LS04
IC2 MC6850P
IC3 74LS11
IC4 74LS27
IC5 INS8255
IC6 TIL 111

Miscellaneous
SK1 2 x 23 or 28 way connector
SK2.3 5 pin PCB mounting socket
SK4,5,6 10 way Minicon latch plug
X1 2MHz crystal
SW1 Click switch, push to make
40 pin DIL socket
24 pin DIL socket
14 pin DIL socket
8 pin DIL socket


More from these topics


Browse by Topic:

Computing

Electronics / Build



Previous Article in this issue

M&A K-1/B Drum Kit

Next article in this issue

Boss TU-12 Tuner


Publisher: Electronics & Music Maker - Music Maker Publications (UK), Future Publishing.

The current copyright owner/s of this content may differ from the originally published copyright notice.
More details on copyright ownership...

 

Electronics & Music Maker - May 1983

Feature by Kenneth McAlpine

Previous article in this issue:

> M&A K-1/B Drum Kit

Next article in this issue:

> Boss TU-12 Tuner


Help Support The Things You Love

mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.

If you value this resource, you can support this project - it really helps!

Donations for March 2025

Please note: Our yearly hosting fees are due every March, so monetary donations are especially appreciated to help meet this cost. Thank you for your support!

Issues donated this month: 0

New issues that have been donated or scanned for us this month.

Funds donated this month: £18.00

All donations and support are gratefully appreciated - thank you.


Magazines Needed - Can You Help?

Do you have any of these magazine issues?

> See all issues we need

If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!

Please Contribute to mu:zines by supplying magazines, scanning or donating funds. Thanks!

Monetary donations go towards site running costs, and the occasional coffee for me if there's anything left over!
muzines_logo_02

Small Print

Terms of usePrivacy