22.09.2015 Views

of Microprocessors

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

300 MUSICAl ApPLICATIONS OF MICROPROCESSORS<br />

For convenience in this design example, each keyboard event will consist<br />

<strong>of</strong> four 8-bit bytes. The first byte will be the key identification, which<br />

will be a binary number between 0 and 60 with 0 corresponding to C l-and<br />

60 corresponding to C6 on the five-octave 61-note keyboard. The most<br />

significant bit <strong>of</strong> this byte will distinguish press events from release events<br />

with a 1 signifying depression. The second byte will be a velocity value in<br />

which small numbers correspond to high velocities (short "float" times). The<br />

third and fourth bytes will be the time <strong>of</strong> day in I-msec increments. Although<br />

this only pins down the time to within 65 sec, that should be quite<br />

close enough to avoid confusion. If desired, a fifth byte could extend unique<br />

timing information to over 4 hr.<br />

The keyboard interface will present these four bytes as 32 parallel bits<br />

that can be read by the using system in any way it sees fit. However, it is<br />

extremely important that a handshake protocol be defined so that there is no<br />

risk <strong>of</strong> an event becoming lost because another event occurred before the<br />

using system could read the first one. This can be accomplished with a<br />

request/response flip-flop similar to the one used with the analog keyboard.<br />

When the keyboard has an event ready, it updates the 32-bit parallel output<br />

and sets the request flip-flop. The using system seeing the request on, reads<br />

the 32 bits and resets the request flip-flop. The keyboard is prevented from<br />

outputting new data while the flip-flop is on. If another event does occur<br />

6502 07 f-,--t"'-------,-----------,-----e---- ~~~A<br />

+5V<br />

10 k<br />

NMI<br />

ROY<br />

SO<br />

16 BITS<br />

16110<br />

LINES<br />

TO FIG.<br />

9-7<br />

10<br />

c:)----------'-----+----'-+---'----_:B~RESS<br />

A80<br />

R/W/-------------f-------'<br />

1 MHz PH0 IRQ10-----------........-"""-0() +5 V<br />

RES PH2<br />

SYSTEM<br />

CLOCK<br />

3K<br />

Fig. 9--4. Keyboard interface microprocessor

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!