Testing COM ports
- Posted by John Kinne <JDKINNE at MIAMIU.BITNET> Oct 30, 1996
- 1820 views
Hello All I am trying to test a COM port, but am not getting anything reasonable back. I have a modem on COM2 (on a PCMCIA card) and am trying to read the response to an ATZ with the following: object o integer i,fn sequence s fn=open("COM2","ub") if fn=-1 then puts(2,"No Go\n") else printf(1,"The file handle is %d\n",fn) puts(fn,"atz\n") puts(1,"Com port written to\n") printf(1,"\n",{}) while 1 do i=getc(fn) if i=-1 then puts(1,"All done\n") exit end if puts(1,i) end while end if The output I get is: The file handle is 3 Com port written to 96 60 7 7 71 47 0 0 And then the pgm hangs until I press ctl-Break. I would like to get an OK back and go on and process - or determine that there is no modem on COM2 and handle that. Any ideas? Thanks John Kinne