Hola que tal,
Bueno la rutina de interrupcion por recepcion de caracter es muy sencilla:
"Aqui entrara cada vez que algo ocurra en el puerto serie
Private Sub MSComm1_OnComm()
Dim dato_rec As String "definimos variable para recoger byte recibido
"dependiendo de lo que halla causado la int hacemos una cosa u otra
Select Case MSComm1.CommEvent
" Errores(no muy importantes, aunque depende de lo que estes haciendo)
Case comEventBreak " A Break was received.
Case comEventCDTO " CD (RLSD) Timeout.
Case comEventCTSTO " CTS Timeout.
Case comEventDSRTO " DSR Timeout.
Case comEventFrame " Framing Error.
Case comEventOverrun " Data Lost.
Case comEventRxOver " Receive buffer overflow.
Case comEventRxParity " Parity Error.
Case comEventTxFull " Transmit buffer full.
Case comEventDCB " Unexpected error retrieving DCB]
" Eventos(nos interesa el de receive)
Case comEvCD " Change in the CD line.
Case comEvCTS " Change in the CTS line.
Case comEvDSR " Change in the DSR line.
Case comEvRing " Change in the Ring Indicator.
Case comEvReceive " Received RThreshold # of chars.
"en las propiedades del mscomm dependiendo de como lo hayas configurado se generará esta int cada caracter recibido, cada dos,...
InBuff = MSComm1.Input "cogemos el dato del puerto
"Recuerda que estara en formato ascii
Case comEvSend " There are SThreshold number of
" characters in the transmit buffer.
Case comEvEOF " An EOF character was found in the
" input stream.
End Select
End Sub
Y mas o menos ya estaria, mira bien las propiedades de configuracion, es decir:
With MSComm1
.CommPort = 2
.Handshaking = 2 - comRTS
.RThreshold = 1 "Cada caracter recibido(8 bits) se genera la int
.RTSEnable = True
.Settings = "9600,n,8,1"
.SThreshold = 1
.PortOpen = True
" Leave all other settings as default values.
End With
Ya me contaras si te funciona o no.
SalU2