Coding in PowerBasic, I can tell if the port was opened or not by executing this code:
CommPort$ = "COM1"
Comm Open CommPort$ As #CommBuf
If ErrClear Then Exit Function ' Exit if port cannot be opened
BUT I ALSO want to detect if there's a device connected to that port (eg, a modem, printer, data collector, phone box, etc.), or else report "Nothing's connected to port: " & CommPort$
I don't want to mistakenly interpret a "non-response" from an existing device to be "no device is present", or to incorrectly interpret a long timeout as "proof of non-existence"...
Is there a test that is ALWAYS able to detect when there is no device connected? (For my situation, a connected device that is not powered up is considered "not connected".)
Thanks for any guidance you can provide,
-John