| ??? 05/17/05 07:36 Read: times Msg Score: +1 +1 Informative |
#93520 - Your MSCOMM Recollection is Wrong Responding to: ???'s previous message |
Your recollection on the MSComm being limited is wrong. I have used it various times to support the use of the Comm port handshake lines. The interface into VB gives full support for simple methods to turn the output control lines (RTS and DTR) on and off....as simple as:
' This function sets the state of the comm port DTR line true or ' false according to the entry argument. A TRUE state sets the ' line on the RS232 interface to a +V level while a FALSE puts ' the line to the -V level. Sub Comm_DTR(DTR_State As Boolean) MSComm.DTREnable = DTR_State End Sub When using the input handshake lines there are even nice ways to detect the handshake transition events (on CTS and DSR for example) as simple as:
Dim CTS_Flag0 As Integer ' flags showing foot switch was pressed
Dim CTS_Flag1 As Integer
' this subroutine receives control when there is an event on the
' MS Comm control. This specifically deals with the CTS input which
' activates when the test box foot switch is activated. This response
' routine will set a global variable flag indicating that the CTS was
' detected pressed. A subsequent timer event will note if the flag is
' set is the CTS still in the same state. If so the CTS is deemed to be
' "debounced" and logic from the timer routine will launch the equivalent
' of the "NEXT" key for the calibrate screen.
Private Sub MSComm_OnComm()
Select Case MSComm.CommEvent
Case comEvCTS ' Change in the CTS line.
If MSComm.CTSHolding = False Then
CTS_Flag0 = 1 ' foot switch seen pressed
Else
CTS_Flag0 = 0 ' foot switch not seen pressed
CTS_Flag1 = 0 ' so clear both of the flags
End If
End Select
End Sub
' timer response routine that supports the "debounce" of the
' foot switch input on the CTS line. The first notification of
' the foot switch comes from the MSComm event processing routine.
Private Sub Comm_Timer_Timer()
' check if to see a "debounced" foot switch has been detected.
If CTS_Flag0 <> 0 Then
If CTS_Flag1 <> 0 Then
' If the Learn Control Button is enabled the invoke its
' click via the foot switch from CTS!!
If MainForm.LearnCtl.Enabled = True Then
Call MainForm.LearnCtl_Click
End If
CTS_Flag0 = 0
CTS_Flag1 = 0
End If
If MSComm.CTSHolding = False Then
CTS_Flag1 = 1
End If
End If
End Sub
Michael Karas |
| Topic | Author | Date |
| Programming RS232 under WinXP | 01/01/70 00:00 | |
| C++ Delphi | 01/01/70 00:00 | |
| Serial Class | 01/01/70 00:00 | |
| Async pro | 01/01/70 00:00 | |
| RS232 programming examples ? | 01/01/70 00:00 | |
| MSComm is limited | 01/01/70 00:00 | |
| Your MSCOMM Recollection is Wrong | 01/01/70 00:00 | |
| re | 01/01/70 00:00 | |
| Win32 API for serial comms | 01/01/70 00:00 | |
| Win XP , thank's for the links | 01/01/70 00:00 | |
| compatibility mode | 01/01/70 00:00 | |
Answer is wrong | 01/01/70 00:00 |



