Another Sony Checksum Question
sieb
Posts: 9
I guess I am checksum challenged...
I am working with the new CAV-CV12ES video switcher. I have not done much with checksums, but the protocol file from sony has a broken cell for the checksum example.
Can anyone help me out with some first steps. I cant even verify that my cabling is correct. Also I know that the baudrate is 9600 (in the manual), but it does not list parity or stop bits. Has anyone used this unit & have the answers?
I have searched threads for the "answer", but I can't seem to find the same explination twice...
Attached is the protocol file, any help would be great...
Thanks--Scott
I am working with the new CAV-CV12ES video switcher. I have not done much with checksums, but the protocol file from sony has a broken cell for the checksum example.
Can anyone help me out with some first steps. I cant even verify that my cabling is correct. Also I know that the baudrate is 9600 (in the manual), but it does not list parity or stop bits. Has anyone used this unit & have the answers?
I have searched threads for the "answer", but I can't seem to find the same explination twice...
Attached is the protocol file, any help would be great...
Thanks--Scott
0
Comments
So, for example. here's a short sample command string.
You skip the first char. Then add up the next chars,
$03+$F4+$82+$00=$179
You only use the last two bytes of the number, so drop the 'one' off.
$79
Now, two's comp is done this way. You simply take the binary bits and flip all of them.
so, $79 = 0111 1001 binary
after inverting all the bits you get 1000 0110 which equals $86
Therefor, the check sum for this string is $86.
You use the Bitwise command BNOT to flip the binary bits of a number.
I'm culling this from the formulas in the spredsheet. I may be totally off base. There is also a way of calculating checksum called 1s compilment. I don't think this is what they're doing. Best thing is give it a try and see if it does something.
Then do what I do and skip the whole check sum crap and make a data table with the commands already writte out with the check sum included.
sum all of the bytes excluding the STX,
subtract one from the sum,
Checksum=BNOT(Checksum) BAND $FF
I am not sure if your device is the same way, but Sony is very consistent.
Thanks! That's an interesting check sum calculation.
If Sony is using a twos-complement for the checksum, and you don't subtract that one first, all the checksums are going to be off. I had a problem with that particular issue while working on a Meridian piece - the docs said use ones-complement, but it was really looking for twos-complement, and I about went nuts wondering why my values were all off by one. Although, I have to admit, some part of me was happy to see even the Meridian techs didn't seem to know the difference.
Thanks for the clarification.
Dave et al,
As is the case when I'm corrected when wrong, I typically go and investigate my thinking. It was interesting that I too fell prey to the same thing you mentioned.
I had my understanding of 2s comp vs 1 comp backwards. I traced back through the programs I did and found that there was a point when I did a Plasma display that said it used 2s comp in the manual, but in reality did 1s comp. I noted in my project notes that I lost a lot of time trying to figure out what the heck I did wrong with the check sum.
I concluded in my notes that I had gotten 1s and 2s comps backwards and later figured it out. I now realize that my origianl understanding was correct and the manual was wrong and thus, I was now wrong and my origianl asumption, which I concluded was wrong, was in fact correct. I've been operating under the incorrect understanding for about a year now...
I'm getting old... first thing to go is the mind...
e