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()?
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
Re: When does the OnComm() of MSComm object trigger?
OnComm is triggered automatically when data is received in the buffer.