Smart-E Matrix Checksum
mshunt
Posts: 23
Hello all,
I've been trying to control a Smart-E 8x8 matrix, the protocol is pretty straightforward, but it requires an XOR checksum on all the previous bytes appended to the end of the string. I could calculate the checksum manually, but that means a huge library of statements to cater for all the different permetations of the matrix.
The code i'm trying to use is
It works in my head, but it's obviously not working in practice as it never gets the right result.
Any ideas?
I've been trying to control a Smart-E 8x8 matrix, the protocol is pretty straightforward, but it requires an XOR checksum on all the previous bytes appended to the end of the string. I could calculate the checksum manually, but that means a huge library of statements to cater for all the different permetations of the matrix.
The code i'm trying to use is
DEFINE_FUNCTION sendswitcherstring(CHAR cmd[50]) { switcherstring="$BE,$EF,cmd" checksum=left_string(switcherstring,1) for(x=2;x<=length_string(switcherstring);x++) { tempstring=mid_string(switcherstring,x,1) checksum=checksum BXOR tempstring } send_string dvSwitcher,"switcherstring,checksum" }
It works in my head, but it's obviously not working in practice as it never gets the right result.
Any ideas?
0
Comments
This seems to work...
I'm still getting my head around different variable types.