Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/21/04 13:12
Read: times


 
#67145 - serial communication in vb
Responding to: ???'s previous message
Public Sub open_port(p)


' 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

On Error GoTo errport:

MSComm1.CommPort = p
MSComm1.PortOpen = True


Exit Sub


errport:

nerro = Err.Number



x$ = MsgBox(Err.Description, vbCritical, " ERROR")



If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
flag_erro = 1
Resume Next
End Sub

Public Sub check_port()

MSComm1.InputLen = 0 ' clear buffer
tempo = 1 'seta flag de tempo
Timer1.Interval = 1000 'Wait 1 secound
MSComm1.Output = "K" + Chr$(13) 'send control
Timer1.Enabled = True
Do
DoEvents
If tempo = 0 Then GoTo no_answer
Loop Until MSComm1.InBufferCount >= 1
' Read the "OK" response data in the serial port.
x$ = MSComm1.Input

MsgBox x$
Timer1.Enabled = False
........






List of 13 messages in thread
TopicAuthorDate
serial communication in vb            01/01/70 00:00      
   RE: serial communication in vb            01/01/70 00:00      
      serial communication in vb            01/01/70 00:00      
   RE: serial communication in vb            01/01/70 00:00      
      RE: serial communication in vb            01/01/70 00:00      
   RE: serial communication in vb            01/01/70 00:00      
      RE: serial communication in vb            01/01/70 00:00      
   Nothing whatsoever to do with 8051            01/01/70 00:00      
      DO it with Vbterm            01/01/70 00:00      
         RE: DO it with Vbterm            01/01/70 00:00      
   RE: serial communication in vb links            01/01/70 00:00      
      serial communication in vb - more links            01/01/70 00:00      
         ...and another            01/01/70 00:00      

Back to Subject List