AnsweredAssumed Answered

vrf CheckSum

Question asked by VRFuser on Aug 16, 2007
Latest reply on Aug 16, 2007 by VRFuser
Dear All,

Oh, for a degree in computer science or better yet to be a full time programmer or drunk!

I am trying to get an instrument to work that needs a checksum using VEE, but I don't have much to go on other than the following from the manufacturer.

Communication is based on a standard RS232 port. All bytes are ASCII except the two CRC bytes used for a redundancy check. Each command starts with four bytes of command type, followed by a variable length value section. The two CRC bytes follow the value string and a carriage return ends the string. Each command string will vary in length but, can not exceed 26 bytes. 
Command String = {4 command bytes + variable length value + 2 CRC bytes + carriage return} < 26 bytes. 
Note: Some commands that request information to be sent back start 

The following is a C version of calculating the cc bytes. 
while(!(crcString [j]==0){ // loop through string and calc a crc until null char 
crc = crc ^ ((INT16U) (crcString [j] * 0x0100); 
if(crc & 0x8000) 
crc = (crc<<1)^0x1021; // prime number 
crc = crc<<1; 


if((crc & 0xff00)==0x0d00) crc +=0x0100; // increment if byte is carriage return 
if((crc & 0x00ff)==0x000d) crc +=0x0001; // increment if byte is carriage return 
if((crc & 0xff00)==0x0000) crc +=0x0100; // no zero bytes allowed 
if((crc & 0x00ff)==0x0000) crc +=0x0001; // no zero bytes allowed 

It will take me a week to figure this out and I would probably enjoy it but its well beyond my skill set and I am in a time-pinch. Any chance one of you experts has a VEE sumcheck program or can parse the above into VEE?

Any help would be much appreciated. Payment will be in virtual beer.

Best wishes,

You are currently subscribed to vrf as:
To subscribe please send an email to: "" with the word subscribe in the message body.
To unsubscribe send a blank email to "".
To send messages to this mailing list, email "".
If you need help with the mailing list send a message to
Search the "unofficial vrf archive" at "".
Search the Agilent vrf archive at "".