Hola a todos, soy nueva programando con visual Basic y debo hacer un proyecto para enviar información a un microcontrolador, por lo que necesito saber sobre el controlador mscomm. Quien me puede ayudar ?
Te envio un código del MSDN sobre el Mscomm, además de eso tiene un evento OnComm que se dispara cuando hay error, o alguna propiedad se ha cambiado: 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 = "ATV1Q0" & Chr$(13) ' Ensure that ' the modem responds with "OK". ' Wait for data to come back to the serial port. Do DoEvents Buffer$ = Buffer$ & MSComm1.Input Loop Until InStr(Buffer$, "OK" & vbCRLF) ' Read the "OK" response data in the serial port. ' Close the serial port. MSComm1.PortOpen = False End Sub
Añade tu respuesta
Haz clic para
o
Añade tu respuesta sólo si conoces la solución a la pregunta.
No lo utilices para hacer una nueva pregunta.
Para pedir más datos de la pregunta utiliza "Pedir más información".
Para aportar más información a una respuesta, añade un comentario.