Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serial port communication using MSComm control.

Status
Not open for further replies.

Katriona

Programmer
Aug 29, 1999
24
AU
I'm trying to pass simple text strings between two computers using a null modem cable. I can't seem to get any response. I'm using the MSComm control and the OnComm event does not seem to be triggered. Any ideas?
 
What oncomm event are you trying to use. If you code is small enough, put it in a reply for me to look at.
 
I'm looking for the comEvReceive event. I have set the RThreshold to 1, which I understand should trigger the OnComm event for each byte of information that is coming in.<br>
<br>
I set these properties on form load: (for both apps)<br>
commport = 2<br>
settings = 1200,n,7,1<br>
portopen = true <br>
<br>
Heres some code I use to prepare and send the string. Any ideas to what I'm missing? When I send the string to the other computer (with an app much the same) the string doesn't seem to be received(OnComm not triggered.) <br>
<br>
Thank you for your help. <br>
<br>
Private Sub cmdSend_Click()<br>
<br>
Dim outstring As String<br>
outstring = Chr(StartStr)& &quot;:&quot; & &quot;TE&quot; & &quot;:&quot; & &quot;ST&quot; & &quot;:&quot; & Chr(EndStr)<br>
txtReceived.Text = outstring<br>
SendString outstring<br>
<br>
End Sub<br>
<br>
Function SendString(InString As String) As Boolean<br>
<br>
MSComm1.Output = InString<br>
<br>
End Function<br>

 
Private Sub cmdSend_Click()<br>
<br>
Dim outstring As String<br>
outstring = Chr(StartStr)& &quot;:&quot; & &quot;TE&quot; & &quot;:&quot; & &quot;ST&quot; & &quot;:&quot; & Chr(EndStr)<br>
txtReceived.Text = outstring<br>
MSCOMM1.output = outstring<br>
'SendString outstring<br>
<br>
The only thing I can suggest right now is to move the mscomm1.output command out of the function for testing. Just to make sure.<br>

 
I'll try that.<br>
Thanks for all your help :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top