Sub btnStart_Action
If cmbPort.Enabled Then
fx.Msgbox(MainForm,"Сначало нужно выбрать COM порт","Ошибка:")
Else
astream.Write(Array As Byte(0x00,0x07,0x52,0x00,kan,0x00,0x00,CRC8(0x00,0x07,0x52,0x00,kan,0x00,0x00)))
End If
End Sub
Sub CRC8 (b0 As Int,b1 As Int,b2 As Int,b3 As Int,b4 As Int,b5 As Int,b6 As Int) As Int
'Log(ForCRC(Bit.Xor(b6,ForCRC(Bit.Xor(b5,ForCRC(Bit.Xor(b4,ForCRC(Bit.Xor(b3,ForCRC(Bit.Xor(b2,ForCRC(Bit.Xor(b1,ForCRC(Bit.Xor(0,b0)))))))))))))))
Return ForCRC(Bit.Xor(b6,ForCRC(Bit.Xor(b5,ForCRC(Bit.Xor(b4,ForCRC(Bit.Xor(b3,ForCRC(Bit.Xor(b2,ForCRC(Bit.Xor(b1,ForCRC(Bit.Xor(0,b0))))))))))))))
End Sub