MAKIN’ MIDI: mistralXG
A USB CONNECTED, PIC-BASED
PART 2: Let’s get technical! BY STEVE RUSSELL
Welcome back! Last time, I described how the user interacts with mistralXG
to switch MIDI streams to the synthesizer and to control the various user
options. This month, I'll lift the hood on the design to show you how the
hardware and software work together to make mistralXG do its thing.
Guided Tour of the Hardware
First, let's take another look at the mistralXG block
diagram (Figure 1).
Comparing this with the circuit schematic (Figure 2),
we can identify the major functional areas of the design. The
detail may be too fine to read in the magazine, so I recommend getting the schematic from the Nuts & Volts website
( www.nutsvolts.com) and opening it with the free version of
Eagle ( www.cadsoft.de/freeware.htm) so you can explore
it more fully. In the meantime, I'll give you an overview.
The hardware is relatively simple. As you can see in
the schematic, there are only a handful of chips: the
PIC18F2550, three 74ALS00s, a couple of dual op-amps,
and an opto-isolator for the MIDI input. The WX IN input
is for a wind controller; as well as receiving the MIDI data,
it provides power to the controller. Make sure anything
you attach to this port is suitable and won't be damaged
by the voltage present at the connector. If you don't need
this input, you can replace it with a second standard MIDI
IN port by duplicating the other MIDI IN circuit.
Areas 1 and 2 implement Switches 1 and 2 in the
block diagram, respectively. Area 3 provides the control
to enable and disable MIDI THRU and MIDI OUT. These
controls use three 74ALS00 logic chips, selected to give a
fast response with low power consumption. Outputs from
the MCU control these features.
Area 4 contains the MCU and its oscillator. The
PIC18F2550 supports many oscillator configurations. I
chose a 4 MHz crystal, running the internal clock at 48
MHz as needed by the USB port. Each MCU instruction
takes four CPU clocks, giving a cycle time of about 83 ns.
To use a different crystal, you'll have to modify the MCU's
configuration settings (mxg_config.c). Q1 is a transistor
that uses pulse width modulation to control the brightness
of the LCD backlight.
The DB50XG daughter card is attached via
connector WB1 (Area 5). The pin numbering used on
WB1 matches the numbering printed on the DB50XG.
The outputs of the DB50XG are protected from
an inadvertent short-circuit by a pair of op-amp buffers
(IC4A&B). A second pair of op-amps (IC5A&B)
provides stereo outputs for headphones; the volume is
controlled by a 50K dual-gang pot. These amplifiers
are in Area 6 in Figure 2. The DB50XG outputs about
3V peak-to-peak, so I've included a way to attenuate
the line outputs. If no attenuation is required, R12 and
R14 should be replaced with plain wire links. As
shown, they are 10K resistors and halve the output
voltage (- 6 dB). You can select an appropriate value
to give the attenuation you need, but I wouldn't go
above about 50K for each of these two resistors — use
1% components to give good stereo matching.
& Line Out
■ FIGURE 1. mistralXG