[comp.sys.amiga] Setting the serial port baudrate from Basic

e85rw@efd.lth.se (Ricard Wolf) (12/07/90)

Hi Amiga fans!

I friend of mine is wrting som compositional software for his Amiga, to
drive synthesizers via MIDI. He has got a small hardware box converting
the RS-232 signal levels to the current loop type interface required by 
MIDI. 

The problem is, he will be writing the code in BASIC, and he can not
set the serial port baud rate to the required 31.25Kbaud requeired by
the MIDI protocol. The only possible baud rates seem to be the 
cannonical 1200,2400,4800 etc. Obviously the serial port can be set
to non-standard baud rates, since it has been done in various sequencer
programs available for the Amiga. The question is, is it possible to do
in a BASIC environment? And in that case, HOW??? Any hints would be
appreciated, even short segments of assembler/machine code...

Of course BASIC is quite slow compared to MIDI, but he is only interested
in driving synthesizers via MIDI out, so even if the serial port is unbufferd
on receiving data, it should be possible to write at a reasonable speed.

Email would be nice (I don't really feel like wading through tons
of Amiga info (I don't actually use one myself (no rotten eggs, please))),
but I guess this would have a wide enough appeal to be posted.

-- 
Ricard Wolf

+--------------------------+-------------------------------------+
| Ricard Wolf              | Lund Institute of Technology        |
| email: e85rw@efd.lth.se  | If you can't buy 'em - build 'em !! |
+--------------------------+-------------------------------------+

dtiberio@csserv1.ic.sunysb.edu (David Tiberio) (12/08/90)

Are you using AmigaBASIC? If so, try a compiler such as Blitz or GFA.

to open the serial port:

open "COM1:19200,n,8,1" as #1

COM1 is the serial port
19200 is the highest baud I have ever used (for my modem)
n is "no parity", your choices may differ
8 is 8 data bits (you can use 7 too
1 is 1 stop bit (you can use 0,1,2)

then INPUT#1 or PRINT#1 to exchange data.

If you want to talk more about BASIC, please contact me. I use HiSoft BASIC
for many of my programs.