Skip to content

Instantly share code, notes, and snippets.

@7m4mon
Created July 13, 2016 12:11
Show Gist options
  • Save 7m4mon/751ff4ec13103360a0db71a4b293a402 to your computer and use it in GitHub Desktop.
Save 7m4mon/751ff4ec13103360a0db71a4b293a402 to your computer and use it in GitHub Desktop.
'RC-S620Sのチェックサムを返す
Function ByteAryToCheckSum(commandAry As Byte()) As Byte
Dim chkSumInt As Integer = 0
For i = 0 To commandAry.Length - 1
chkSumInt = chkSumInt + CInt(commandAry(i))
Next
chkSumInt = 256 - chkSumInt Mod 256
If chkSumInt = 256 Then chkSumInt = 0
Return CByte(chkSumInt)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment