Today is...
Monday, August 20, 2018
Welcome to, the global online
community of automation professionals.
Featured Video...
Featured Video
A tutorial introduction to programming using the QuickBuilder Programming Environment.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Visual Basic Code for Serial Communication
Want to transmit data from serial communication protocol to VB.6
By HASBALLAH on 3 April, 2018 - 8:20 am

I have serial communication protocol transmit data. I want make vb.6 code. Each package has 21 bytes and starts with Chr(2) and ends up with
Chr(13). Serial data baud rate is adjustable between 300, 600, 1200, 2400, 4800, 9600, 19200, 38400. Data length is 8 bits, and there is no parity. Data will be sent only after standstill condition is reached. Order of bytes in each package is as follows:


By Ron Hoover on 7 April, 2018 - 6:31 pm

Put a comm control on a form

Call this sub to open the form

Public Sub OpenCommExample()
With frmMenu
.Comm.Settings = "9600,N,8,1"
.Comm.CommPort = 4
.Comm.RThreshold = 1
.Comm.HandShaking = comNone
.Comm.PortOpen = True
End With

Send Data to form

Public Sub CommSend(ByVal sData As String)
frmMenu.Comm.Output = sData
End Sub

Make Data String

Public Function MakeDataString(ByVal sDataIn As String) As String
Dim sX As String
sX = Chr$(2)
sX = sX & sDataIn
sX = sX & vbCr
MakeDataString = sX

End Function<.pre>