cdholding image

comm32 home
comm32 forum
buy comm32

Introduction
Install Comm32
Why Not MsComm?

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


Comm32 Properties
   .DeviceName
   .EOFChar
   .EvtChar
   .EvtCharEnable
   .OutPutEx
   .OutPutMode
   .ParallelEnable
   .TxTimeout

Comm32 Functions
   .getByte

   .GetPortStatus
   .InstalledDrivers
   .putByte
   .PortExists
   .ReadBytes
   .ReadString
   .WriteBytes
   .WriteString

OnComm Event
Hardware/Cables etc

Input

Retrieves data from the Input buffer.

Not available at design time. ReadOnly at Runtime

MSComm32 and Comm32 have identical behavior

         Syntax value = object.Input
     
  object Name of the communications control.
  value

Depends on the InputMode property (See the InputMode property)

If InputMode is InputModeText then value must be a String variable
If InputMode is InputModeBinary then value must be an Array of Bytes


 
Example assuming that the InputMode property is 0 (InputModeText)
 
        

Dim s as String

s = AxComm1.Input

MsgBox( Len(s) )

Msgbox(s)

MsgBox( Mid(s,1,1))

Msgbox( Asc( Mid(s,1,1) ) )

'// Data is received into a standard string variable.

'// Read some data from the port

'// How many characters did we get ?

'// Display the whole String

'// Display just one character (The first one)

'// Display the Ascii Value of the first character
 

If your data is mainly text and you intend to process your data using string handling functions then set the InputMode property to InputModeText. Your data may also contain control codes and non-printable byte data so you don't need to use Binary mode just because your text contains a few non-printable non-text characters. You can still access individual elements of the string using the Mid( ) function and use the Asc( ) function to get the byte value.


        
Example assuming that the InputMode property is 1 (InputModeBinary)
 
 

Dim b( ) as Byte

b = AxComm1.Input

MsgBox( UBound(b)+1 )

MsgBox(b)

MsgBox( Chr( b(0) )

MsgBox b(0)

'// Data is received into an array of bytes
'// Don't initialize/size the array.


'// How many bytes did we get ?

'// Will fail because b is not a string.

'// Display the first byte as a character

'// Display the Ascii value of the first byte
    If your data contains little or no text then set the InputMode property to InputModeBinary.

Remarks:

The behavior of this property is affected by the InputMode property. You will see from the above examples that both modes can return the same data but how you then process that data depends on whether the data is returned as a string or an array of bytes.

 

 

 

Copyright (c) 2010 Axis Controls Ltd