detecting non-working serial interface 
Author Message
 detecting non-working serial interface

Can anyone give me some guidance on how to do this:  I have a 3 wire
serial port connection that I'm using to communicate with an external
device.  When everything is working correctly, the external device will
reply to a command I send through the serial interface (using OPEN
"COM1:...,RS,CS,DS,CD" as #1 then PRINT #1, cmdstring and INPUT #1,
ans$).  This is all fine as long as I use the correct com port and the
external device is powered.  What I need is some way to detect if the
port doesn't respond in a certain time, so I can then try changing to
COM2.  If COM2 doesn't respond either then I want to display a message.
What happens now is that I send my cmdstring and the program hangs,
waiting for a response that never comes.  I would think that there must
be a simple solution for this.  Any ideas?


Tue, 18 Dec 2001 03:00:00 GMT  
 detecting non-working serial interface
On Fri, 02 Jul 1999 13:09:48 -0400, Joe Turner

Quote:

>Can anyone give me some guidance on how to do this:  I have a 3 wire
>serial port connection that I'm using to communicate with an external
>device.  When everything is working correctly, the external device will
>reply to a command I send through the serial interface (using OPEN
>"COM1:...,RS,CS,DS,CD" as #1 then PRINT #1, cmdstring and INPUT #1,
>ans$).  This is all fine as long as I use the correct com port and the
>external device is powered.  What I need is some way to detect if the
>port doesn't respond in a certain time, so I can then try changing to
>COM2.  If COM2 doesn't respond either then I want to display a message.
>What happens now is that I send my cmdstring and the program hangs,
>waiting for a response that never comes.  I would think that there must
>be a simple solution for this.  Any ideas?

Try polling the Com port rather than just doing the INPUT#1.

Check the on-line help under LOC(n).  This will tell you if there is
anything in the Rx buffer.  You can loop on this test until you choose
to abandon the exercise and try the next port (hic).  If it comes up

Quote:
>0 then you know there is a response, although I usually test for >1

to avoid surplus delimiters left after previous tests, or startup
transients from the peripheral.

If you need an example plse email me and I'll dig out a proggie i
wrote a few years back, in Qbasic 1.1.

HTH

Peter
PERTH - WESTERN AUSTRALIA
Remove the NOWHERE from reply address



Wed, 19 Dec 2001 03:00:00 GMT  
 detecting non-working serial interface


Quote:
>Can anyone give me some guidance on how to do this:  I have a 3 wire
>serial port connection that I'm using to communicate with an external
>device.  When everything is working correctly, the external device will
>reply to a command I send through the serial interface (using OPEN
>"COM1:...,RS,CS,DS,CD" as #1 then PRINT #1, cmdstring and INPUT #1,
>ans$).  This is all fine as long as I use the correct com port and the
>external device is powered.  What I need is some way to detect if the
>port doesn't respond in a certain time, so I can then try changing to
>COM2.  If COM2 doesn't respond either then I want to display a message.
>What happens now is that I send my cmdstring and the program hangs,
>waiting for a response that never comes.  I would think that there must
>be a simple solution for this.  Any ideas?

I think you're looking for
  ON COM nn GOTO
and the use of a time variable. If you don't get an answer in n seconds then
swithch ports or bail out.

   ____    _    ____      ____  _____
  |  _ \  / \  / ___) __ | ___)(_   _) Don Schullian

  |____//_/ \_\(____/\__/|_|     |_|    www.DASoftVSS.com
  ___________________________________   www.basicguru.com
      Vertical Software Solutions



Wed, 19 Dec 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VB5 Pro: Interfacing with non VB apps

2. ActiveX: Accessing events on non default interfaces

3. How to use non-default interface, late-bound?

4. Non Rectangular Interface!!!!

5. Interfacing with non-VB applications - seeking help

6. Non-standard serial baud rates

7. Accessing non-default interfaces

8. Component to retrieve non-default interfaces

9. TSAC non-scriptable interface

10. accessing the non default interface of a COM object from VB

11. Non-Compiled Local Interface Definition

12. TSAC non-scriptable interface

 

 
Powered by phpBB® Forum Software