5-10
MIDI Port I/O Programming
Sending MIDI Data
Once in UART mode, MIDI data can be sent to an external MIDI device by writing to
the Data port.
Example code:
mov
dx,wMpuBaseAddx
;MPU-401 base I/O address
inc
dx
;Status port
Busy:
in
al,dx
;Read status port
test
al,40h
;Ready for output?
jnz
Busy
;No
mov
al,bMidiData
;Get MIDI data
dec
dx
;Data Port
out
dx,al
;Output MIDI data
Reading MIDI Data
When MIDI data is available from an external MIDI device, it can be read in from the
Data port. There are two modes used in detecting the availability of input data: polling
and interrupt.
When in polling mode, as before, input data is available when bit 7 of the Status port is
zero. Conversely, when bit 7 is a one, no MIDI data is available.
In interrupt mode, an interrupt occurs when a MIDI code is ready. An interrupt service
routine has to be set up to retrieve the MIDI code. Reading from the Data port will
clear the interrupt signal.
The sequence for reading MIDI data is identical in both polling and interrupt modes.
Below is a code fragment that can be used in either the polling routine or the interrupt
service routine:
mov
dx,wMpuBaseAddx
;MPU-401 base I/O address
inc
dx
;Status port
Busy:
in
al,dx
;Read status port
test
al,80h
;MIDI data available?
jnz
Busy
;No
dec
dx
;Data port
in
al,dx
;Read MIDI data, and clear interrupt
Under the MPU-401 UART mode, there is no timing information available. It is up to
the application to handle the timing for the MIDI data.
Содержание SB0350
Страница 29: ......
Страница 71: ...Mixer Chip Programming 4 13 Figure 4 4 Logical Schematic of the Output Mixing Paths ...
Страница 72: ...4 14 Mixer Chip Programming Figure 4 5 Logical Schematic of the Input Mixing Paths ...
Страница 141: ...Index3 ...