Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!uhccux!hale!whinery From: whinery@hale.ifa.hawaii.edu (Alan Whinery) Newsgroups: comp.sys.amiga Subject: Re: RS-232 & MIDI Interface Message-ID: <9441@uhccux.uhcc.Hawaii.Edu> Date: 18 Sep 90 19:14:54 GMT References: <49417@olivea.atc.olivetti.com> Sender: news@uhccux.uhcc.Hawaii.Edu Organization: Institute For Astronomy, Hawaii Lines: 49 In article <49417@olivea.atc.olivetti.com> borzieri@king.ICO.Olivetti.Com (Ivan Borzieri) writes: >I tried to write a little basic prog which reads from the RS-232 data coming >from my keyboard through a MIDI interface. > >I tried to set the RS-232 at 9600,N,7,1 and something was read. >I then tried to set it at 19200,N,7,1 and something else was read ! (then >I got a crash) >How is that possible ? Whenever the serial chip in your Amiga sees what it thinks is a start bit, it will take eight samples at the current baud rate and then if it gets what it thinks is a stop bit, it will assume it has received a byte. SO, if the data coming in is not at the same baud rate, you will get garbage based on some random falling edge as the start of the start bit, etc. > >I read that MIDI standard allows instruments to output data at a maximum of >31000 bauds. It means, I think, that if the RS-232 works at a maximum speed >of 19200, the MIDI device works as a buffer ! Close, but no banana. The baud rate of specification MIDI data is ALWAYS 31250 baud. (Some manufacturers use 62500 for parameter loads, but that's not MIDI spec) RS-232c includes no specification for maximum speed, although it does address limitations of transmission media (I think.) Your Amiga is fully capable of doing RS232c at 100k baud or so, so 31250 MIDI is not a problem. > >Does anyone know HOW I SHOULD SET RS-232 TO GET THE RIGHT DATA ? >Is it possible to write a simple program to catch dump data in basic or I >should use C ? There are two readily available ways to make BASIC do MIDI. ==> 1. Use Preferences to set your serial speed to 31250 baud (1.3 at least), in BASIC, open SER: device like you would a file, read and write from/to it and you will be able to mess around with MIDI or whatever it is you're trying to serialize. I have successfully done this, and although it is limited, it allows one to experiment and learn how MIDI works. 2. Get the publicly distributable Pregnant Badger MIDI libraries, which, although written for use with C, do come with instructions for use with BASIC. This is a much more involved approach, probably involving a couple of days of experimentation and frustration and reading the manuals, unless you are a STAR BASIC programmer. > > Ivan Borzieri Alan Whinery Comedian, coyote, genius, whinery@hale.ifa.hawaii.edu