Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!mcnc!borg!oscar!tell From: tell@oscar.cs.unc.edu (Stephen Tell) Newsgroups: comp.sys.amiga.programmer Subject: Re: AREXX Question: Reading ser: port Message-ID: <3397@borg.cs.unc.edu> Date: 23 Apr 91 20:30:22 GMT References: <17683@venera.isi.edu> Sender: news@cs.unc.edu Organization: University of North Carolina, Chapel Hill Lines: 50 In article <17683@venera.isi.edu> schur@venera.isi.edu (Sean Schur) writes: >I am trying to use AREXX to control a Lyon-Lamb Minivas. This is a single >frame recorder controller for single framing images to videotape. The >MiniVas has a standard RS232 port. It accepts standard ASCII characters >for control. > The problem I am having with this >(and it is probably AREXX ignorance) is that after sending a character >with "writech" I am using "readch,1" to look for a single character. >The program isn't receiving one and the script completely freezes, I can't >get out of it at all without rebooting. >So, how do I tell AREXX to TRY to read a character, if it doesn't get >one within a specified length of time, to return control of the program >to me so I can type another character. It would also be desirable to >have the script echo the character to me immediately as opposed to >writing it into a file to look at later. The problem is with the SER: handler; it just isn't designed for this "give me a character if there is one, or else time out" sort of operation. I have had good luck writing quick & dirty serial applications from C by opening up UUSER:, a driver that comes with the AmigaUUCP package. I use open(), and then when I try to read() a single character the read times out with an error if there is no character to read after the timeout specified in the open string (somthing like "UUSER:serial.device/1/R500/C0/G0" for 500 millisecond timeout). This should work with Arexx if it handles errors from the AmigaDos I/O routines reasonably and lets you read and write from the same filehandle. From C, its easier to use the lower level I/O functions, like open() or Open() as opposed to dealing with stdio and fopen(), which don't do bidirectional I/O quite as gracefully. I have Arexx, but haven't used it enough to comment on it directly. UUSER: is designed to run under the getty program also in the UUCP package, but it seems to work fine by itself. >Sean Schur USENET: schur@isi.edu >Assistant Director Amiga/Media Lab Compuserve: 70731,1102 >Character Animation Department Plink: OSS259 >California Institute of the Arts Steve -- Steve Tell tell@cs.unc.edu H: +1 919 968 1792 #5L Estes Park apts CS Grad Student, UNC Chapel Hill. W: +1 919 962 1845 Carrboro NC 27510 Duke Blue Devils: 1991 NCAA Basketball National Champions! We're Number 1 !! UNLV 90-91 record: "34 and DUKE."