CRC &LT


roiyjet

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

Archived

This topic is now archived and is closed to further replies.