CRC &LT


roiyjet
 Share

Recommended Posts

Hi 

We have Serial Pressure transmitter that have special protocol , we know how to write and read manualy from the Device.

we try to use the CRC function we found in your Form 

private crc = 0xffff
private raw = asca(buffer)
for (private x = 0, x < GetLength(buffer), x++)
   crc = crc # raw[x]
   for (private j = 0, j < 8, j++)
	  if (crc & 0x0001)
		 crc = crc >> 1
		 crc = crc # 0xA001
	  else
		 crc = crc >> 1
	  endif
   endfor
endfor
return(crc)

I have stupid but it may explain me everything , what is the

&lt  is it Lower Then ? why nopt to use < ?

what is the AMF ?  

what is  crc = crc &gt;&gt; 1 ?  (is it CRC>1 ) ?

 

Regards

Roy 

Link to comment
Share on other sites

OK, somewhere along the line, the system or your browser encoded the code for browser compatibility.  &gt; means a greater than sign.  &lt; is less than, &amp; is the amperstand.  Once you replace those it should make sense.  Note however that this is the CRC for Modbus.  Not all systems use the same CRC and you should probably look at your device's documentation to see how they do it.

private crc = 0xffff
private raw = asca(buffer)
for (private x = 0, x < GetLength(buffer), x++)
   crc = crc # raw[x]
   for (private j = 0, j < 8, j++)
      if (crc & 0x0001)
         crc = crc >> 1
         crc = crc # 0xA001
      else
         crc = crc >> 1
      endif
   endfor
endfor
return(crc)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share