roiyjet Posted June 5, 2018 Share Posted June 5, 2018 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 < is it Lower Then ? why nopt to use < ? what is the AMF ? what is crc = crc >> 1 ? (is it CRC>1 ) ? Regards Roy Link to comment Share on other sites More sharing options...
AzeoTech Posted June 6, 2018 Share Posted June 6, 2018 OK, somewhere along the line, the system or your browser encoded the code for browser compatibility. > means a greater than sign. < is less than, & 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.