Modbus ASCII With Visual Basic: Function 06 Write Single Register
LRC (Longitudinal Redundancy Check) is calculated by summing up, module 256, the values of the bytes from ADR1 to last data character then calculating the hexadecimal representation of the 2’s-complement negation of the sum.
Private Function LRC(data As Byte()) As Byte
If data Is Nothing Then
Throw New ArgumentNullException("Parameter is null or empty")
End If
Dim result As Byte = 0
For Each b As Byte In data
result += b
Next
result = CByte((result Xor &HFF) + 1)
Return result
End Function
DataType: https://drive.google.com/drive/folder...
Password: [email protected]
Private Function LRC(data As Byte()) As Byte
If data Is Nothing Then
Throw New ArgumentNullException("Parameter is null or empty")
End If
Dim result As Byte = 0
For Each b As Byte In data
result += b
Next
result = CByte((result Xor &HFF) + 1)
Return result
End Function
DataType: https://drive.google.com/drive/folder...
Password: [email protected]
همه توضیحات ...