Results 1 to 3 of 3

Thread: When does the OnComm() of MSComm object trigger?

  1. #1

    Thread Starter
    Addicted Member charmedcharmer's Avatar
    Join Date
    Sep 2003
    Posts
    211

    Resolved When does the OnComm() of MSComm object trigger?

    Hi guys I just want to know when does the OnComm() event trigger? Im new to this kind of programming and there arent that much resource I could find. Assuming I have this code:
    Code:
    MSComm1.Output = <command>
    LogEvent() 
    UpdateDatabase()
    
    Public Sub LogEvent()
    Text1.Text = <statement>
    End Sub
    
    Public Function UpdateDatabase() as Boolean
    Recordset1.Open <source>, <connectionstring>, <cursortype>, <locktype>, <option>
    if <condition> = True
        UpdateDatabase = True
    Else
        UpdateDatabase = False
    End If
    End Function
    
    Private Sub MSComm1_OnComm()
    'Statement blah blah
    End Sub
    I have a few questions here:
    1. When does the OnComm() event trigger?
    2. I have a hunch that the OnComm() triggers right away when the modem responds but what happens if I have a code being executed that takes quite time (like saving or quering from the database) at the time the oncomm() would be triggering. Does this mean my OnComm() won't trigger anymore?
    3. What if I have a timer, what then happens to the OnComm()?
    C++ Programming is overwhelming.

    Dont let it overwhelm you or you'll fall into the oblivion of its perfection

  2. #2
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    579

    Re: When does the OnComm() of MSComm object trigger?

    I have used the MSComm control in an unusual way to provide remote control switching to the players in my playout system. My belief is that it is interrupt driven, because it never fails to provide an OnComm event. I too have timers running for clocks etc and it simply never fails. Even if a player is loading and checking a file (plenty of loops here), it still triggers.

    For anyone interested here is what I use;

    Pin 1 - Player 1 (DCD Data Carrier Detect)
    Pin 6 - Player 2 (DSR Data Set Ready)
    Pin 8 - Player 3 (CTS Clear to Send)
    Pin 4 - Common (DTR Data Terminal Ready +12v)

    During the OnComm event check for;

    Code:
    If MSComm1.CDHolding = True Then 'Player 1
    If MSComm1.DSRHolding = True Then 'Player 2
    If MSComm1.CTSHolding = True Then 'Player 3

  3. #3
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: When does the OnComm() of MSComm object trigger?

    OnComm is triggered automatically when data is received in the buffer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width