Burkert Type 8056 User Manual
Page 93
- 93 -
RS232_485_ETP_MODBUS_BU_REV02.doc
MsgBox(vfStrErrorString, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical,
Me
.Text)
Return
False
End
Try
End
Function
Private
Sub
SerialPort1_DataReceived(
ByVal
sender
As
Object
,
ByVal
e
As
System.IO.Ports.SerialDataReceivedEventArgs)
Handles
SerialPort1.DataReceived
Try
TextBox2.Invoke(
New
myDelegate(
AddressOf
decode),
New
Object
() {})
Catch
vObjExcept
As
Exception
vfStrErrorString =
"Form name: "
&
Me
.Name & vbCrLf & _
""
& vbCrLf & _
"Error source: "
& vObjExcept.Source & vbCrLf & _
""
& vbCrLf & _
"Error StackTrace: "
& vObjExcept.StackTrace & vbCrLf & _
""
& vbCrLf & _
"Error Message: "
& vObjExcept.Message
MsgBox(vfStrErrorString, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical,
Me
.Text)
Return
End
Try
End
Sub
Private
Sub
decode()
Dim
vIntBytesToRead
As
Integer
Dim
vStrRecevebuffer
As
String
=
""
Dim
vIntN
As
Integer
Dim
vDblTemp
As
Single
Dim
vLngTemp
As
Long
Dim
afByteTemp(0
To
3)
As
Byte
Try
vIntBytesToRead = SerialPort1.BytesToRead
If
vIntBytesToRead >= 81
Then
lblProcessData.Text =
""
ReDim
afByteReceveBuffer(0
To
vIntBytesToRead - 1)
SerialPort1.Read(afByteReceveBuffer, 0, vIntBytesToRead)