cdholding image

comm32 home
comm32 forum
buy comm32

Introduction
Install SComm32
Why Not MsComm?

Properties
   .Break
   .CDHolding
   .CommEvent
   .CommName
   .CommPort
   .CTSHolding
   .DSRHolding
   .DTREnable
   .EOFChar
   .EOFEnable
   .Handshaking
   .InBufferCount
   .InBufferSize
   .Input
   .InputLen
   .InputMode
   .NullDiscard
   .OutBufferCount
   .OutBufferSize
   .OutPut
   .OverlappedIO
   .ParityReplace
   .PortOpen
   .RThreshold
   .RTSEnable
   .Settings
   .STHreshold

OnComm Event
Hardware/Cables etc

CommEvent

Retrieves a numerical event code indicating the most recent communications event or error.

Not Available at Design time. Read Only at RunTime

MSComm32 and SComm32 have "Similar" Behavior. (SComm32 is improved - See below)

  Syntax value = object.CommEvent
     
  object Name of the communications control.
  value A numeric expression containing the numeric event code being one of the following
       
    1 = comEvSend
There are fewer than Sthreshold number of characters in the transmit buffer.
    2 = comEvReceive
There are more than Rthreshold number of characters in the receive buffer.
    3 = comEvCTS
Change in Clear To Send line.
 
    4 = comEvDSR
Change in Data Set Ready line. This event is only fired when DSR changes from 1 to 0.
    5 = comEvCD
Change in Carrier Detect line.
 
         6 = comEvRing
Ring detected. Some hardware may not support this event.
    7 = comEvEOF
End Of File character received.
 
     
    1001 = comEventBreak
A Break signal was received.
 
    1002 = comEventFrame
The hardware detected a framing error.
 
    1006 = comEventOverrun
The hardware could not receive data fast enough and some was lost
    1007 = comEvEOF
End Of File character received.
 
    1008 = comEventRxOver
Receive Buffer Overflow. There is no room in the receive buffer. Some data was lost
    1009 = comEventRxParity
Parity Error. The hardware detected a parity error.
    1010 = comEventTxFull
Transmit Buffer Full. The transmit buffer was full while trying to queue a character.
    1011 = comEventDCB
An error occurred while setting up the Windows Com driver.
          Example  
 

If object.CommEvent > 1000 then
      MsgBox ("A communications ERROR occurred")
End If

   

Remarks:

When using Event driven communications you would generally respond to the OnComm event and then interrogate the CommEvent property to decide what the cause of the OnComm event was. (The CommEvent property contains the code/reason for the raising of the OnComm event)

If you are not using an OnComm event in your project then you can still interrogate this property to retrieve the most recent event or error status.

 

Improvement(s)

When using MSComm32 the CommEvent property can, under some conditions, change unexpectedly - for example if MSComm32 attempts to fire another comm event before you finish executing the previous one. (Under some conditions MSComm32 OnComm event is re-entrant)

When you are handling an SComm32 OnComm event no further events will be triggered - any further events are queued so that you get them one after the other - the CommEvent property will therefore not change unexpectedly.

 

 
32bit development in VB6 using the Comm32 Communications OCX ?

Or are you looking for a proper .Net Component ?

Carry on using most of the common and well documented MSComm32 syntax but with a proper .net component allowing you to build x86, x64 and AnyCPU projects using Visual Studio 2005, 2008 and 2010.

www.Comm64.com
The x86, x64 and AnyCPU
Serial component

 

 

Copyright (c) 2010 Axis Controls Ltd