MSCOMM and multiple serial ports 
Author Message
 MSCOMM and multiple serial ports

Quote:

>Has anyone successfully polled multiple serial ports using the MSCOMM vbx?  If I use
>one port at a time the data comes in just fine, but if I dial with two modems they
>will both dial and detect any change in CD, but only one modem will be receiving data.

>This is very frustrating.  I've looked at the example in the /vb/samples/visdata/vbterm
>sample program, but everything that I have tried has yielded the same results.  Why
>would one serial port's onComm event supersede another one?  

>With this being event-driven, I wouldn't think that this would occur.  <???>

I have an app which handles up to four ports, and although I'm using
PDQComm, I saw the same problem when each "terminal" session was using
OnComm for receive; one of the terminals would hog the processor.
Don't know why that happens, most likely before the OnComm routine
finished, another character had come in so that's the port that kept
active.

The solution is to receive data manually - create one loop which polls
all active ports and spools in their characters (don't process them in
this loop, just keep it small and quick).  Look up "idle loops" in the
Microsoft VB manual (Std Edn, it's pg 416) for a description of how to
define it.  The "idle loop" will run whenever there are no other
events, such as user activity.    If you have any methods or loops
elsewhere which can run for too long, include DoEvents() there to give
the polling loop a chance to run.

-Andy

---------------------------------------------------------------------

Senior Hardware Designer   21 Fitzgerald Rd   voice (613)596-9922x251
 Product Support Group     Nepean, Ontario    fax   (613)596-0574


------------------- CUSTOMER FIRST, QUALITY ALWAYS ------------------



Tue, 17 Mar 1998 03:00:00 GMT  
 MSCOMM and multiple serial ports

Quote:


>>Has anyone successfully polled multiple serial ports using the MSCOMM vbx?  If I use
>>one port at a time the data comes in just fine, but if I dial with two modems they
>>will both dial and detect any change in CD, but only one modem will be receiving data.

>>This is very frustrating.  I've looked at the example in the /vb/samples/visdata/vbterm
>>sample program, but everything that I have tried has yielded the same results.  Why
>>would one serial port's onComm event supersede another one?  

>>With this being event-driven, I wouldn't think that this would occur.  <???>

>I have an app which handles up to four ports, and although I'm using
>PDQComm, I saw the same problem when each "terminal" session was using
>OnComm for receive; one of the terminals would hog the processor.
>Don't know why that happens, most likely before the OnComm routine
>finished, another character had come in so that's the port that kept
>active.

>The solution is to receive data manually - create one loop which polls
>all active ports and spools in their characters (don't process them in
>this loop, just keep it small and quick).  Look up "idle loops" in the
>Microsoft VB manual (Std Edn, it's pg 416) for a description of how to
>define it.  The "idle loop" will run whenever there are no other
>events, such as user activity.    If you have any methods or loops
>elsewhere which can run for too long, include DoEvents() there to give
>the polling loop a chance to run.

>-Andy

I haven't experienced this problem at all.  I've written a VB3 program
which manages up to 8 serial ports (on a Digiboard) that sends out data
and receives it just as the MSCOMM documentation says it will.  I
created 8 COMM device objects in an array in one of my forms, and have no
problems.

The devices that I communicate with are all running at 9600 baud, however,
so  maybe the effects described above are not really apparent in my
case.



Wed, 18 Mar 1998 03:00:00 GMT  
 MSCOMM and multiple serial ports

Quote:



>>>Has anyone successfully polled multiple serial ports using the MSCOMM vbx?  If I use
>>>one port at a time the data comes in just fine, but if I dial with two modems they
>>>will both dial and detect any change in CD, but only one modem will be receiving data.
>>I have an app which handles up to four ports, and although I'm using
>>PDQComm, I saw the same problem when each "terminal" session was using
>>OnComm for receive; one of the terminals would hog the processor.
>>Don't know why that happens, most likely before the OnComm routine
>>finished, another character had come in so that's the port that kept
>>active.
>>The solution is to receive data manually - create one loop which polls
>>all active ports and spools in their characters (don't process them in
>>this loop, just keep it small and quick).  Look up "idle loops" in the
>>Microsoft VB manual (Std Edn, it's pg 416) for a description of how to
>>define it.  The "idle loop" will run whenever there are no other
>>events, such as user activity.    If you have any methods or loops
>>elsewhere which can run for too long, include DoEvents() there to give
>>the polling loop a chance to run.

>I haven't experienced this problem at all.  I've written a VB3 program
>which manages up to 8 serial ports (on a Digiboard) that sends out data
>and receives it just as the MSCOMM documentation says it will.  I
>created 8 COMM device objects in an array in one of my forms, and have no
>problems.

>The devices that I communicate with are all running at 9600 baud, however,
>so  maybe the effects described above are not really apparent in my
>case.

What kind of Digicomm board are you using Darryl, and what type of PC
(486DXxx) ? In particular, does the Digiboard have an on-board
processor?  I looked at them for my 4-port app, but the 8 port
Digiboard cards usually had an on-board processor (which would be
good, but expensive).

How do the 8 ports appear to VB - Com1 through Com8?  There's someone
else I work with who needs to write a many-port program.

-Andy

--------------------------------------------------------------------------
Andy Fraser              | The generation of random numbers

--------------------------------------------------------------------------



Thu, 19 Mar 1998 03:00:00 GMT  
 MSCOMM and multiple serial ports


Quote:


>>>Has anyone successfully polled multiple serial ports using the MSCOMM vbx?  If I use
>>>one port at a time the data comes in just fine, but if I dial with two modems they
>>>will both dial and detect any change in CD, but only one modem will be receiving data.

>>The solution is to receive data manually - create one loop which polls
>>all active ports and spools in their characters (don't process them in
>>this loop, just keep it small and quick).
>>-Andy

>I haven't experienced this problem at all.  I've written a VB3 program
>which manages up to 8 serial ports (on a Digiboard) that sends out data
>and receives it just as the MSCOMM documentation says it will.  I
>created 8 COMM device objects in an array in one of my forms, and have no
>problems.

>The devices that I communicate with are all running at 9600 baud, however,
>so  maybe the effects described above are not really apparent in my
>case.

Thanks for the answers guys.  I'm going to look into the idle loop solution,
but it seems that Darryl has got it just right using MSCOMM.  I'm using a
Boca multi-port board and connecting to three devices at 9600 baud, although I
have the same problem on a PC with three separate (IRQ and address selectable) serial
ports as well.  In the on_comm event, I am using a case statement and then sending
the data to a subroutine to process the incoming data.  Darryl, are you doing this
as well or are you processing the data inside of the oncomm event?  

I wonder if the fact that your comm objects are all part of an array has anything
to do with it (being successful)?

Thanks again for the reply,

jpd

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Jeff Debrosse                  % Paradigm Technologies          %

% http://www.*-*-*.com/ ~jdebros/ % C{*filter*}Springs, FL 33071        %
% DOS * OS/2 * Win3.1/95 * LINUX % VOICE/FAX: 305.346.9175        %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



Fri, 20 Mar 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. mscomm - send/receive from serial port

2. ?MSCOMM - Read Signals From Serial Ports

3. Mscomm, serial port question

4. Using serial port without using MSCOMM

5. Mscomm doesn't hear my serial port

6. MSComm problem with multi-port serial card

7. VB Communications, MSComm, Serial Ports and Modems...

8. Modems, Serial Ports, MSComm and VB

9. Modem, serial port, MSComm and VB Communications

10. Serial port, MSComm, Modem and VB communication

11. VB3 Serial Port Control without MSCOMM.VBX

12. Problems with opening the serial port using MsComm

 

 
Powered by phpBB® Forum Software