Solved GWBASIC OPEN COM error message

June 1, 2012 at 23:41:34
Specs: DOS 6.22, 902MHz Celeron/256MB RAM
OPEN "COM2:9600,N,8,1" AS #1 gives the "Device Unavailable" error message. The manual says that means the hardware is not installed (not true-- I use it regularly and it works fine outside of GWBASIC) or that I invoked GWBASIC with the /C:0 option, shutting down the port (also not true). I used the GWBASIC program successfully on several other computers, the last being about 10 years and two computers ago, but now I need it again and I can't find any way to make this line work on this computer with an otherwise working COM2 port. I tried PATCHCRT.EXE on it, to make old DOS programs work on PCs that run above 200MHz, but it did not recognize it. Any ideas?

See More: GWBASIC OPEN COM error message

Report •

#1
June 2, 2012 at 03:33:06
Hi Garth,

this might be silly, but are are you sure the pc has a COM2 port, as while early computers had two, generally more modern computers only have one COM port.

If it does have a COM2 port and it is being used for printing, I wonder if to do this COM2 has been 'taken over' by a MODE command rerouting LPT1.

As a matter of interest, where are you based? I am in Hammersmith, West London.

Please advise back if any progress.

Good Luck - Keep us posted.


Report •

#2
June 2, 2012 at 07:49:21
Thanks for the response. I have the MODE COM2: setup in the autoexec.bat file, and nothing is redirected. I use both COM2 and LPT1 regularly from the MultiEdit programmer's text editor (which is way better than any I've seen available for a GUI BTW). In that situation, COM2 goes to the workbench computer for development, and LPT1 goes to the printer. Just in case MultiEdit did anything to it, I re-started the computer, but had no success getting GWBASIC to use COM2.

Report •

#3
June 6, 2012 at 20:11:13
✔ Best Answer
Someone on another forum suggested trying COPY COM2: FILE.TXT, so I looked up the COPY command and I couldn't find anything in the manual that implied it could be used with a COM port, but I thought, "Oh well, I'll just try it!" I got a similar error message. Then I wondered if something else could have gone wrong, so I connected back up to the workbench computer and went to give it a command, and realized that it was indeed COM1, not COM2! You know how it is when you get used to something being in a particular place and you click on it without paying attention to what it says in the box anymore? I had forgotten it was now on COM1 on this computer, although I was clicking on the right thing. I try to do my homework before bothering others with questions, but anyway, it's working!

Report •

Related Solutions

#4
June 7, 2012 at 11:17:19
Hi Garth,

with the mode command I would expect it to end in ,P e.g.:-

MODE COM1:9600,N,8,1,P

This parameter turns on the handshaking/flow control and without, if the data is too fast for the port, some can be lost.

Should the basic statement you use have the same parameter?

As a matter of interest, where are you based? I am in Hammersmith, West London.

Good Luck - Keep us posted.


Report •

#5
June 7, 2012 at 12:18:38
I do use the P in the DOS MODE command in the AUTOEXEC.BAT file because without it the sending would stop with an error message saying the receiver wasn't ready if I sent commands to the workbench computer that required waiting for something else on the workbench for example and then continued and filled the 256-byte buffer so no more was accepted. The handshaking lines kept data from being lost though. The closest thing I see to the DOS command's P in the GWBASIC OPEN "COM command looks to be the CS option for example, to set a time-out period on CTS. In this project using GWBASIC however, the PC is only receiving data, not sending. I've had some other big setbacks in this project which I started many years ago but left to collect dust until recently, but it's moving now again. I am in California.

Report •

Ask Question