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 gkittelson 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

Status
Not open for further replies.

shaminda

Programmer
Jun 9, 2000
170
US
I am trying to talk from one computer to another using the two serial ports. I am using female to female RS-232 cable and a null modem adapter to connect the two computers. And I am planing to use the MSComm control. One computer writes and the other computer reads this is all I need to do. How do I write programs to do this?
 
Lil'but helpful (i think) sample :cool:

Code:
Private Sub Form_Load ()
	' Buffer to hold input string
	Dim Instring As String
	' Use COM1.
	MSComm1.CommPort = 1
	' 9600 baud, no parity, 8 data, and 1 stop bit.
	MSComm1.Settings = "9600,N,8,1"
	' Tell the control to read entire buffer when Input
	' is used.
	MSComm1.InputLen = 0
	' Open the port.
	MSComm1.PortOpen = True
	' Send the attention command to the modem.
	MSComm1.Output = "AT" + Chr$(13)
	' Wait for data to come back to the serial port.

Do
		DoEvents
	Loop Until MSComm1.InBufferCount >= 2
	' Read the "OK" response data in the serial port.
	Instring = MSComm1.Input
	' Close the serial port.
	MSComm1.PortOpen = False
End Sub
bluenote@uyuyuy.com
(excuse my english)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top