Sub send_CMD_String (address As Int, CMD As Int, DAT As Int)
Dim sb As StringBuilder
Dim cmd_String As String
Dim buffer() As Byte
sb.Initialize
sb.append(Chr(address)). append(Chr(CMD)) .append(Chr(DAT))
cmd_String = sb.ToString
buffer=cmd_String.GetBytes("ISO-8859-1")
timeout = 0
timer1.Initialize("Timer1", 500)
timer1.Enabled = True
Do While timeout=0
AStream.Write(buffer)
If (checkbyte1 = address) And (checkbyte2 = CMD) And (checkbyte3=DAT) Then Exit
Loop
If (checkbyte1 <> address) Or (checkbyte2 <> CMD) Or (checkbyte3 <> DAT) Then
ToastMessageShow ("COMMUNICATION ERROR", True)
End If
End Sub