What in the world is COM0 on Windows?

For issues with communication ports, protocols, etc.
danube7
Posts: 10
Joined: Nov 16, 2018 20:29

What in the world is COM0 on Windows?

Postby danube7 » May 13, 2021 21:29

Hi all,

I am running FB 1-06.0 on a Windows 7 OS. The code below seems to work, and returns with a return code of 0 (no errors). This should NOT BE as COM 0 simply doesn't exist on Windows. Is this an accidental holdover from Linux?

If I un-comment the second "OPEN" in the code below, the program throws Error Code 2, "File not found signal", which is the same response as what happens if COM1 is already open. Could COM0 be mapping to COM1 on Windows 7?

Does anyone else have this same behavior?

Dan


Code: Select all

#lang "qb"
CLOSE
OPEN  "COM0: 300,N,8,1,ME,CS0,DS0,RS" FOR OUTPUT AS #1
PRINT #1, "Hello World."
'OPEN  "COM1: 300,N,8,1,ME,CS0,DS0,RS" FOR OUTPUT AS #2
CLOSE
SLEEP
MrSwiss
Posts: 3849
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: What in the world is COM0 on Windows?

Postby MrSwiss » May 13, 2021 22:06

Could COM0 be mapping to COM1 on Windows 7?
FB-manual says yes (on Windows): about Open Com "COMn: ..."
I think that using ME parameter during development may pose to be problematic (suppressing errors).
danube7
Posts: 10
Joined: Nov 16, 2018 20:29

Re: What in the world is COM0 on Windows?

Postby danube7 » May 13, 2021 22:36

Ah, yes. I see that now. I read that several times, but missed that line. But technically, it says
On the Windows platform "COM:" maps to "COM1:"

There is nothing there about COM0, and when we construct the string to feed to the OPEN COM function, i.e.
"COMn: [ baudrate ][ , [ parity ][ , [ data_bits ][ , [ stop_bits ][ , [ extended_options ]]]]]"

...the "0" is there explicitly, so there must be something about the way the compiler parses that string that also accepts COM0 as legit.

Anyway, not a real problem but it did cause some confusion as I wrote a routine to check for an error if an incorrect COM port is selected, and
I was expecting that program to throw an error when I selected COM0.

Dan

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 1 guest