1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
REM ouverure port com série
Try
com_prog = My.Computer.Ports.OpenSerialPort(EB400_1.port_name, 9600)
Catch ex As Exception
MessageBox.Show(ex.Message)
Return
End Try
com_prog.ReadTimeout = 5000 'timeout 5 s
System.Threading.Thread.Sleep(100) 'tempo 100ms
REM connection programmateur
Try
com_prog.Write(Chr(fprog.pc_connect))
c = com_prog.ReadByte()
Catch ex As Exception 'programmateur non connecté
MsgBox(EB400_1.port_name & " " & ex.Message)
End Try
If c = Asc(ack) Then
message.Text = "Programmateur EIB connecté"
Else : MsgBox("Programmateur EIB non connecté !!! code: " & c)
com_prog.Close()
Return
End If
System.Threading.Thread.Sleep(5000) 'tempo 100ms |
Partager