HomeSI_SCOPESI_COMMSERIAL SPYContact Us!

 

 

 

The following code is from an example program included with SI_COMM. The program is a simple break out monitor that displays the state of the modem signals RI, CTS, DCD, and DSR. Shown below is the compiled program running under Windows 95.

vbexample.gif (1338 bytes)

The diodes are just VB shape controls colored Green when the signal is high or Black when the signal is low. 


'************************************************************************
'*  This source file is provided as a supplement to the SI_COMM package.
'*
'*  SI_COMM.OCX Copyright (C) 1998 Software Innovations Inc
'*  All rights reserved.
'*
'************************************************************************
Option Explicit
'************************************************************************
'************************************************************************

Private Sub Form_Load()

' Open the port...
    SI_COMM1.PortOpen = True

' Initialize the diodes to the state of the Modem Signals....

   If SI_COMM1.CTS = True Then shpCTS.FillColor = vbGreen
   If SI_COMM1.DSR = True Then shpDSR.FillColor = vbGreen
   If SI_COMM1.DCD = True Then shpDCD.FillColor = vbGreen
   If SI_COMM1.RI = True Then shpRI.FillColor = vbGreen

' Tell the control to generate a CommEvent whenever on of the Modem
' Signals change...


   SI_COMM1.DeltaDCD = True
   SI_COMM1.DeltaCTS = True
   SI_COMM1.DeltaRI = True
   SI_COMM1.DeltaDSR = True

End Sub

'************************************************************************
' In the CommEvent handler decode the nature of the event by examining the
' the value in iEventCode. Set the color of the correct diode to Green
' if the signal is high, Black if the signal went low.
'************************************************************************

Private Sub SI_COMM1_CommEvent(ByVal iEventCode As Integer)

   Select Case iEventCode

   Case DCDEvt

      If SI_COMM1.DCD = True Then
         shpDCD.FillColor = vbGreen
      Else
         shpDCD.FillColor = vbBlack
      End If

   Case CTSEvt

      If SI_COMM1.CTS = True Then
         shpCTS.FillColor = vbGreen
      Else
         shpCTS.FillColor = vbBlack
      End If

   Case DSREvt

      If SI_COMM1.DSR = True Then
         shpDSR.FillColor = vbGreen
      Else
         shpDSR.FillColor = vbBlack
      End If
   Case DSREvt

      If SI_COMM1.RI = True Then
         shpRI.FillColor = vbGreen
      Else
         shpRI.FillColor = vbBlack
      End If
End Select

End Sub

horizontal rule

 

Copyright © 1999-2004 Software Innovations Inc.
This page last updated on 05/03/2008
For more information please email us at: info@rs232-serial-communications.com or call us at 845-566-1919
Copyright © 2008 Software Innovations, Inc.
Last modified: 05/03/08