transmit signals from com1 to com2 using mscomm 
Author Message
 transmit signals from com1 to com2 using mscomm

Hello All,

I am using windows 98se, vb6 with sp4.   I want to transmit signals from
com1 to com2.
Problems:
1.  com2 can not receive the data?
2.  Does  the progam coding of data transmittion from com1 to com2
correct?

Please help!!!

Thank you for your great attention.

Regards,

Wallace

Option Explicit
Dim bStop As Boolean
Dim sInString As String

Private Sub cmdStart_Click()
    bStop = False

    MSComm1.Output = "abcde" & vbCr
    Do
        DoEvents
    Loop Until MSComm1.OutBufferCount = 0

    If MSComm2.InBufferCount Then
        Label1.Caption = MSComm2.Input
    End If

End Sub

Private Sub cmdStop_Click()
    Label1.Caption = ""
End Sub

Private Sub Form_Load()
    bStop = False

    With MSComm1
        .InputLen = 0
        .InputMode = comInputModeText
        .CommPort = 1
        .Settings = "9600,E,7,2"
        .Handshaking = comRTSXOnXOff
        .PortOpen = True

    End With

    With MSComm2
        .InputLen = 0
        .CommPort = 2
        .Settings = "9600,E,7,2"
        .Handshaking = comRTSXOnXOff
        .InputMode = comInputModeText
        .PortOpen = True
    End With

End Sub

Private Sub Form_Unload(Cancel As Integer)
    MSComm1.PortOpen = False
    MSComm2.PortOpen = False
End Sub

Private Sub MSComm1_OnComm()
    With MSComm1
        Select Case .CommEvent
            Case comEventBreak
                MsgBox "Error", "1comEventBreak"
            Case comEventFrame
                MsgBox "Error", "1comEventFrame"
            Case comEventOverrun
                MsgBox "Error", "1comEventOverrun"
            Case comEventRxOver
                MsgBox "Error", "1comEventRxOver"
            Case comEventRxParity
                MsgBox "Error", "1comEventRxParity"
            Case comEventTxFull
                MsgBox "Error", "1comEventTxFull"
            Case comEventDCB
                MsgBox "Error", "1comEventDCB"
        End Select
    End With
End Sub

Private Sub MSComm2_OnComm()
    With MSComm2
        Select Case .CommEvent
            Case comEventBreak
                MsgBox "Error", "2comEventBreak"
            Case comEventFrame
                MsgBox "Error", "2comEventFrame"
            Case comEventOverrun
                MsgBox "Error", "2comEventOverrun"
            Case comEventRxOver
                MsgBox "Error", "2comEventRxOver"
            Case comEventRxParity
                MsgBox "Error", "2comEventRxParity"
            Case comEventTxFull
                MsgBox "Error", "2comEventTxFull"
            Case comEventDCB
                MsgBox "Error", "2comEventDCB"
        End Select
    End With

End Sub



Mon, 08 Sep 2003 16:13:50 GMT  
 transmit signals from com1 to com2 using mscomm
Hello All,

I am using have null-modem cable to connect the ports.

Sorry for my missing this info.

Thanks,

Wallace

Quote:

> Hello All,

> I am using windows 98se, vb6 with sp4.   I want to transmit signals from
> com1 to com2.
> Problems:
> 1.  com2 can not receive the data?
> 2.  Does  the progam coding of data transmittion from com1 to com2
> correct?

> Please help!!!

> Thank you for your great attention.

> Regards,

> Wallace

> Option Explicit
> Dim bStop As Boolean
> Dim sInString As String

> Private Sub cmdStart_Click()
>     bStop = False

>     MSComm1.Output = "abcde" & vbCr
>     Do
>         DoEvents
>     Loop Until MSComm1.OutBufferCount = 0

>     If MSComm2.InBufferCount Then
>         Label1.Caption = MSComm2.Input
>     End If

> End Sub

> Private Sub cmdStop_Click()
>     Label1.Caption = ""
> End Sub

> Private Sub Form_Load()
>     bStop = False

>     With MSComm1
>         .InputLen = 0
>         .InputMode = comInputModeText
>         .CommPort = 1
>         .Settings = "9600,E,7,2"
>         .Handshaking = comRTSXOnXOff
>         .PortOpen = True

>     End With

>     With MSComm2
>         .InputLen = 0
>         .CommPort = 2
>         .Settings = "9600,E,7,2"
>         .Handshaking = comRTSXOnXOff
>         .InputMode = comInputModeText
>         .PortOpen = True
>     End With

> End Sub

> Private Sub Form_Unload(Cancel As Integer)
>     MSComm1.PortOpen = False
>     MSComm2.PortOpen = False
> End Sub

> Private Sub MSComm1_OnComm()
>     With MSComm1
>         Select Case .CommEvent
>             Case comEventBreak
>                 MsgBox "Error", "1comEventBreak"
>             Case comEventFrame
>                 MsgBox "Error", "1comEventFrame"
>             Case comEventOverrun
>                 MsgBox "Error", "1comEventOverrun"
>             Case comEventRxOver
>                 MsgBox "Error", "1comEventRxOver"
>             Case comEventRxParity
>                 MsgBox "Error", "1comEventRxParity"
>             Case comEventTxFull
>                 MsgBox "Error", "1comEventTxFull"
>             Case comEventDCB
>                 MsgBox "Error", "1comEventDCB"
>         End Select
>     End With
> End Sub

> Private Sub MSComm2_OnComm()
>     With MSComm2
>         Select Case .CommEvent
>             Case comEventBreak
>                 MsgBox "Error", "2comEventBreak"
>             Case comEventFrame
>                 MsgBox "Error", "2comEventFrame"
>             Case comEventOverrun
>                 MsgBox "Error", "2comEventOverrun"
>             Case comEventRxOver
>                 MsgBox "Error", "2comEventRxOver"
>             Case comEventRxParity
>                 MsgBox "Error", "2comEventRxParity"
>             Case comEventTxFull
>                 MsgBox "Error", "2comEventTxFull"
>             Case comEventDCB
>                 MsgBox "Error", "2comEventDCB"
>         End Select
>     End With

> End Sub



Mon, 08 Sep 2003 16:22:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Serial COM1 or COM2 port

2. loosing data sending from com1 to com2 on same PC

3. real time data reading from com1 and com2 port

4. Sending file from COM1 to COM2

5. How to get data from COM1 or COM2

6. How to get data from COM1 or COM2 (use VB)

7. ImpresiĆ³n por COM1 o COM2

8. Signal to COM2

9. Com1 or Com2

10. Problems with COM1 using MSComm

11. Com1 or com2

12. COM2 works like COM1 under Win9x

 

 
Powered by phpBB® Forum Software