Table of Contents
Real-time Clock Configuration
The MIDIator Model MS-124W is a general purpose Serial-to-MIDI interface derived from the MS-124 (IBM PC). Its design allows for a number of configurations to enable practical communication between the standard serial port of most computer systems and numerous MIDI devices. Up to 64 logical MIDI channels can be supported by multiplexing the data through a single system serial port under software control.
The standard version uses the RS-232C Interface Standard. The interface is configured as Data Communication Equipment using an industry standard DB-25S serial connector. The communication rate is fixed at 38,400 baud, preserving compatibility with the Key MS-114. Hardware handshaking signals are provided to coordinate data transfer to the MIDI outputs.
Four MIDI outputs are provided and may be used in three modes, selectable via front panel switches. Identical data may be sent to all ports simultaneously in the S/A "single addressed" mode. Using M/A "multiple addressed" mode, the desired port is addressable under software control using modem control signals. Finally, M/B "multiple burst" mode uses a select byte to enable any combination of outputs, followed by a MIDI data byte. The single MIDI input port functions identically in all modes.
The MS-124W may be powered from most serial ports when used in the basic configuration. An optional external power supply is available for applications where this is not practical.
The MS-124W is connected to the computer by a serial cable that is terminated by a DB-25P connector. A standard modem cable for the particular computer system will suffice for most applications. Both hardware and software considerations may require the use of a modified serial cable for some applications. The cable specifications give the connector pinouts if needed for cable fabrication.
Connections to the MIDI equipment may be made using standard three conductor MIDI cables. Most modern MIDI units have MIDI Thru outputs, allowing up to three sound modules to be daisy chained to a single MIDI Out (more than three units may reduce reliability since there is a cumulative signal degradation from each MIDI Thru). If required, external power may be furnished from a Key Electronics model AD-12 AC Adaptor. The cable from the adaptor should be plugged into the EXT PWR jack. The AD-12 takes 115 VAC input and outputs 12 VAC at 100 mA to a 3.5 mm phone plug. Adaptors for other voltages may generally be obtained from local sources.
The MS-124W has an internal real-time clock which may be selected by moving a shunt to different pins on jumper headers. The shunt can be moved by hand, but a pair of tweezers or needle nosed pliers makes the job much less tedious.
The cover must first be removed to provide access to the headers. Remove the four screws on the sides of the MS-124W and carefully slide the cover from the chassis. A diagram of shunt connections is shown in Figure 1.
Caution should be exercised when touching the internal circuitry, since static electricity can damage the CMOS integrated circuits. The unit can be handled with perfect safety if you will keep one hand in contact with the metal shell of the serial connector at all times while moving the shunts. If the pliers or tweezers have insulated handles you should keep a finger in contact with the bare metal to prevent the possibility of static charge on the pliers.
The location and pin numbering of the jumper header, J1, is shown in Figure 1.
Real-time Clock Configuration
The MS-124W contains a real-time clock oscillator which is useful for MIDI application programs such as sequencers. The clock signal is available on the CD (carrier detect) line of the serial port. The clock frequency is set by a non-precision, high stability RC oscillator. Nominal frequency is 250 +- 50 Hz. A calibration procedure using the system timer services should be used to ascertain the actual clock frequency. The clock may be disabled using jumper header J1.
Enable/disable Real-time Clock - J1
Enabled 2-3 Disabled 1-2
Writing programs for the MS-124W is a relatively simple task. All configuration options are externally set by the front panel switches, and no complex communication protocols are required for handshaking. Two ready signals are provided to coordinate MIDI output, one for 38,400 baud operation and one for port switching. Burst mode output and MIDI input require no handshaking with the MS-124W.
Programming for MIDI Input
Due to the high data rate of MIDI (3,125 bytes/second), it is recommended that most applications programs use interrupt driven input routines. Data can be placed in a ring buffer of sufficient size to fit the particular application. The serial port interrupt should have sufficient priority in the system to assure service within one MIDI byte period (320 microseconds) or data may be lost. No receive error signals are provided from the MS-124W.
Open loop input routines have been successfully implemented on systems as slow as an IBM PC (8088 microprocessor, 4.77Mhz). These are very inefficient, however, and require much of the CPU time. Much faster systems can perform more complicated tasks, such as sequencing, but the code generally requires an undue amount of optimization and it is very difficult to adhere to well structured programming practices.
Programming for Addressed MIDI Output
There are three main considerations when writing programs for MIDI output. Operation at 38,400 baud requires that the output routines test the MIDI Ready signal (CTS) to prevent data loss. Multiport operation requires a test of Port Ready (DSR) before selecting a new port. Finally, port powered usage imposes some restrictive conditions on the state and timing of the Port Select signals (DTR and RTS).
Since it takes longer to send a MIDI byte (320 microseconds) than a serial port byte (260 microseconds), measures must be taken to prevent overflow of the output buffer. The MS-124W provides a MIDI Ready signal (CTS) to inform the system that it is permissible to send a byte. Normally a logical 1, MIDI Ready will shift to a logical 0 upon receipt of the start bit of an outgoing byte. It will remain in the 0 (busy) state for 320 microseconds and then return to 1 (ready).
Output routines should send a byte only when MIDI Ready is asserted. Since there is an indeterminate delay between writing a byte to the serial port and the start bit, it is best to verify the busy state transition after sending data, particularly for very fast systems. Many systems can generate an interrupt on both transitions, making the handshaking process more efficient. Those that cannot should wait for the busy state after each transmission. Slower systems can sometimes omit the busy state verification.
Further, MIDI ready/busy is the only test that need be performed for the vast majority of systems, since the timing of the MIDI ready prevents
Copyright (c) MIDIator Systems, 1999