Article View: comp.sys.amiga.tech
Article #5121Re: ARexx and the serial port
From: Steve Masters
Date: Sun, 02 Sep 1990 18:28
Date: Sun, 02 Sep 1990 18:28
45 lines
2726 bytes
2726 bytes
dan-hankins@cup.portal.com (Daniel B Hankins) writes:
> Can anyone provide advice on how to use ARexx to access the serial port?
>Can Arexx keep up with 2400 baud (on a stock 68K Amiga)?
I have written an Arexx system that access an electronic barometer in real
time across the Amiga serial port. I hit several stumbling blocks you may
be interested in. The bigest single problem was the behavior of the READCH
function. The statement
a=READCH('ser',1) /* 'ser' was previously opened as SER: */
will hang until a character is received by the serial port. This caused me
a major headache since my barometer does not always respond to each character
sent...you must often repeat a command two or three times to get a response.
Thus, a ( send command...wait for response) loop would not work. What I
needed was a function that 'read a character from an open file, return a
null string (or error indication) if no character is available.' This behavior
would be similar to the INKEY$ function in BASIC. I never found such a function.
If one exists (or can be easily duplicated) I would be quite interested.
My solution was to start two processes. Process A (the main program) sends commands
to the serial port, which it has opened for output. Process B simply listens
to the serial port, which it has opened for input. When it receives a character,
it sends the character to process A via the ADDRESS command. Process A periodically
checks its port via GETPKT(), which will return a null string if nothing has been
sent. This solution taught me quite a bit about ARexx message passing, but
was tricky to program without frequently hanging one task or the other. I would
prefer a more straightforward approach.
Based on my experience, my solution would not keep up with a steady 2400 baud
transmission. If a more traditional approach would work, I think it MIGHT
work as long as ARexx wasn't having to contend with too many other tasks.
> I'd heard that Larry Phillips had written a program called SerMod which
>does at least -some- of what I'm looking for. If so, where can I find it?
I would also be interested in any Rexx/SER: interfacing programs or info.
Steve Masters stevem@hal.CSS.GOV
ENSCO, Inc.
Melbourne, FL 32940 USA
(407) 254 4122
Technical Details
Message-ID:
<454@hal.CSS.GOV>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!mips!dimacs.rutgers.edu!seismo!hal!stevemReferences:
<33454@cup.portal.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!mips!dimacs.rutgers.edu!seismo!hal!stevem From: stevem@hal.CSS.GOV (Steve Masters) Newsgroups: comp.sys.amiga.tech Subject: Re: ARexx and the serial port Message-ID: <454@hal.CSS.GOV> Date: 2 Sep 90 18:28:57 GMT References: <33454@cup.portal.com> Organization: ENSCO Inc., Melbourne FL Lines: 45