Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
If log = False Then
If hexa = True Then
Texto.Text = Texto.Text & ascii2hex(MSComm1.Input) '+ vbCrLf
End If
If ascii = True Then
Texto.Text = Texto.Text & MSComm1.Input '+ vbCrLf
End If
If binario = True Then
Texto.Text = Texto.Text & ascii2bin(MSComm1.Input) '+ vbCrLf
End If
If decim = True Then
Texto.Text = Texto.Text & ascii2bin(MSComm1.Input) '+ vbCrLf
End If
Else
If hexa = True Then
Print #archivoLog, ascii2hex(MSComm1.Input) '+ vbCrLf
End If
If ascii = True Then
Print #archivoLog, MSComm1.Input '+ vbCrLf
End If
If binario = True Then
Print #archivoLog, ascii2bin(MSComm1.Input) '+ vbCrLf
End If
If decim = True Then
Print #archivoLog, ascii2bin(MSComm1.Input) '+ vbCrLf
End If
Seek (archivoLog), LOF(archivoLog) - 1 'hago que se imprima todo seguido en el archivo
End If
End If
Texto.SelStart = Len(Texto.Text)
TextoEnviar.SetFocus
End Sub