Creative SB0350 Programming Manual page 84

Hardware programming guide
Table of Contents

Advertisement

Enter UART Mode
In order to send or receive MIDI data, the command byte 3Fh must first be sent out to
switch the interface into UART mode. A Command Acknowledge byte of 0FEh will be
made available on the Data port if the mode switch is successful.
In UART mode, MIDI data is sent to and received from the Data port. The Reset
command is used to exit UART mode.
Example code:
mov
dx,wMpuBaseAddx
inc
dx
Busy:
in
al,dx
test
al,40h
jnz
Busy
mov
al,3Fh
out
dx,al
sub
cx,cx
Empty:
in
al,dx
test
al,80h
jnz
NextLoop
dec
dx
in
al,dx
cmp
al,0FEh
je
InUartMode
inc
dx
NextLoop:
loop
Empty
;***
;*** Failed to switch to UART mode
An interrupt is generated when the interface is set to UART mode. It is not necessary to
set up an interrupt service routine to handle the interrupt because reading from the Data
port will clear the interrupt signal.
It important that your application send the MPU-401 reset command to exit the MIDI
UART mode when your application terminates.
MIDI Port I/O Programming
;MPU-401 base I/O address
;Status port
;Read status port
;Ready for output?
;No
;Output "Enter UART mode"
;
command via Command port
;Maximum of 65536 tries
;Read status port
;Input data ready?
;No
;Data port
;Read data
;Successful mode switch?
;SUCCESS!
;Status port
;Try again
5-9

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents