home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / MIDI / MIDI-CNV.LBR / MIDI-CNV.DZC / MIDI-CNV.DOC
Text File  |  2000-06-30  |  6KB  |  137 lines

  1.  
  2.                      RS232 TO MIDI CONVERTER           23-Jan-89
  3.                      -----------------------
  4.  
  5. 1. Introduction
  6.  
  7. The  following notes provide details on building an RS232 to MIDI 
  8. interface.  The  only  requirement is that the computer  have  an 
  9. RS232 port that can be programmed to operate at 31.25 Kbaud.
  10.  
  11. 2. MIDI
  12.  
  13. Many  electronic  music  instruments are now fitted with  a  MIDI 
  14. (Musical   Instrument  Digital  Interface)  port.   This   allows 
  15. instruments  to control (or be controlled) by other  instruments. 
  16. A computer fitted with a MIDI port makes an excellent  instrument 
  17. controller.  Some  of the applications being - a MIDI multi-track 
  18. recorder/sequencer  or  a  voice  editing  program  for  a   MIDI 
  19. synthesizer.
  20.  
  21. MIDI is actually very similar to the RS232 serial  standard.  The 
  22. only differences being that MIDI operates at 31.25 Kbaud and uses 
  23. a 5 mA current loop rather than voltage levels.  It uses an 8 bit 
  24. word, 1 stop bit and no parity. Provided that your computer has a 
  25. serial interface that can be programmed to operate at 31.25 Kbaud 
  26. then the only other need is for a simple RS232 to MIDI interface.
  27.  
  28. 3. MIDI Interface
  29.  
  30. The  interface features both MIDI IN and MIDI OUT ports and  uses 
  31. readily  available  components.  The  circuit has  been  designed 
  32. specifically  to  use  a  cheap  opto-isolator  rather  than  the 
  33. expensive  (and  often  difficult to obtain)  6N138  or  HCPL2730 
  34. usually  specified.  To simplify matters,  0v instead of -12v  is 
  35. used  as the negative RS232 output level.  This should not  be  a 
  36. problem  as most computers use the 1489 receiver chip which  will 
  37. operate  with 0v input.  Power requirements for the interface  is 
  38. modest.  Either  +12v or +5v (see circuit diagram) is  obtainable
  39. in most instances from the host computer's RS232 port. 
  40.  
  41. To  see  the circuit diagram of the interface,  simply  send  the 
  42. ascii file MIDI-CNV.CIR to your screen or printer.
  43.  
  44. 4. Connections
  45.  
  46. After  building  the  interface,  check  the  wiring  thoroughly. 
  47. Incorrect  connections are likely damage either computer or  MIDI 
  48. instrument.
  49.  
  50. Connect  the  interface  between  a spare  serial  port  on  your 
  51. computer  (RS232  channel  B  in the case of  the  Ampro  Z80  or 
  52. Bondwell 14) and the MIDI instrument.  Some computers may require 
  53. the  connections going to pins 2 and 3 of the RS232 connector  be 
  54. reversed.
  55.  
  56.  
  57. Computer                 Interface                MIDI Instrument
  58.  
  59.  RS232              RS232          MIDI              MIDI
  60.  
  61.  -----,             ,--------------------,          ,--------
  62.       |             |             OUT  4 | -------- | 4 IN
  63.  TX 2 | ----------- | 2                  |          |
  64.       |             |             OUT  5 | -------- | 5 IN
  65.       |             |                    |          |
  66.       |             |                    |          |
  67.       |             |              IN  4 | -------- | 4 OUT
  68.  RX 3 | ----------- | 3                  |          |
  69.       |             |              IN  5 | -------- | 5 OUT
  70.       |             |                    |          |
  71.     7 | ----------- | 7--,               |          '--------
  72.       |             |    |               |
  73.  -----'             '----|-----|---------'
  74.                          |     |
  75.                         gnd  +12v
  76.  
  77. Note - A MIDI cord consists of a two-wire cable with a 5 pin  180 
  78. degree  DIN audio connector on each end.  Pin 4 connects to pin 4 
  79. and pin 5 connects to pin 5. Two such cords will be required.
  80.  
  81. 5. Testing
  82.  
  83. Once  you  have built the interface,  it can be tested  with  the 
  84. simple Basic program provided.  There are versions of the program 
  85. for the Ampro Z80 Little Board and the Bondwell 14.  If using the 
  86. Bondwell  you  will need to make a modification to  the  computer 
  87. first. See note elsewhere.
  88.  
  89. If  you  have a computer other than these then you will  have  to 
  90. modify  the  program  accordingly.  The main  requirement  is  to 
  91. correctly  initialise  your RS232 port for 31.25  Kbaud,  8  data 
  92. bits, 1 stop bit and no parity.
  93.  
  94. The  program itself does little more than send a note to the MIDI 
  95. instrument  when a key on the computer keyboard is  pressed.  The 
  96. pitch of the note varies depending on which key has been  struck. 
  97. Make  sure  that  your  MIDI instrument is set  receive  on  MIDI 
  98. channel 1 (there are 16 possible MIDI channels).
  99.  
  100. Well that's it. Once everything checks out you are ready to write 
  101. some  good MIDI software.  If you do,  it is a good idea to  keep 
  102. your hardware specific code (eg. serial port initialisation) in a 
  103. separate module.  This will allow others with different  machines 
  104. to get your code running with a minimum of trouble. 
  105.  
  106. 6. Bondwell 14 Modifications
  107.  
  108. The  following modification to the Bondwell allows Serial Port  B 
  109. to  be  used  for MIDI applications while leaving Serial  Port  A 
  110. unchanged  and  usable  for  normal  RS232  applications  (modem, 
  111. printer etc). The modification is simple and does not require the 
  112. cutting any tracks.
  113.  
  114. The  baud rate generator in the Bondwell uses a 1.8432 Mhz  clock 
  115. to  derive  all the standard RS232 baud rates.  To  generate  the 
  116. required  baud rate for MIDI (31.25 Kbaud) a clock  frequency  of 
  117. 500  Khz  or  a multiple  thereof  is  needed.  The  modification 
  118. disconnects  the 1.8432 Mhz clock from 8253 timer 1 and  replaces 
  119. it  with  a 2 Mhz signal.  Timer 1 can then be programmed  for  a 
  120. division ratio of 4 giving the required 500 Khz.
  121.  
  122. a) Remove  top cover and locate 8253 timer chip.  Remove it  from    
  123.    its socket.
  124.  
  125. b) Obtain a 24 pin IC socket which has flat pins.  Bend pin 15 of 
  126.    the socket upwards. Plug the socket into the socket vacated by 
  127.    the 8253.  Ensure that the bent pin is not in contact with pin 
  128.    15 of the motherboard socket.
  129.  
  130. c) Obtain  a  length  of wire-wrap wire.  Solder one end  to  the 
  131.    upturned socket pin. Solder the other end of the wire to pin 6 
  132.    of IC39 (74LS04).
  133.  
  134. d) Insert 8253 into piggy-backed socket and replace cover.
  135.  
  136.                       ---------------------
  137.