Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Fabio Luis Girardi via fpc-pascal
To array of bytes, check this: https://github.com/fluisgirardi/pascalscada_v0/blob/master/src/scada/crc16utils.pas There are two routines: one to calculate, another to check if crc16 matches. Em ter., 25 de out. de 2022 às 08:13, Giuliano Colla via fpc-pascal < fpc-pascal@lists.freepascal.org>

Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Giuliano Colla via fpc-pascal
Il 25/10/22 09:58, Marco Borsari via fpc-pascal ha scritto: On Tue, 25 Oct 2022 08:30:19 +0200 Bo Berglund via fpc-pascal wrote: Is there some package or code available somewhere which can calculate the CRC16 value over a byte array of some 1000 bytes?

Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Jean SUZINEAU via fpc-pascal
I couldn't verify the code but it should be  relatively close to your  c++ example. Not sure of the width of int type, I supposed it's 16 bits wide: function CRC16( crc: Word; buf: PByte; len: Word; Poly:Word=$A001): Word; var    pos: Word;    i: Word; begin for pos:= 0 to len-1 do   

Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Dimitrios Chr. Ioannidis via fpc-pascal
Hi, On 2022-10-25 09:30, Bo Berglund via fpc-pascal wrote: < snip > Anyone able to help with FPC implementation? Take a look here, https://forum.lazarus.freepascal.org/index.php?topic=54791.0 regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal

Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Marco Borsari via fpc-pascal
On Tue, 25 Oct 2022 08:30:19 +0200 Bo Berglund via fpc-pascal wrote: > Is there some package or code available somewhere which can calculate the > CRC16 > value over a byte array of some 1000 bytes? http://www.retroarchive.org/swag/CRC/index.html -- Simplex sigillum veri

Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Bo Berglund via fpc-pascal
On Tue, 25 Oct 2022 08:30:19 +0200, Bo Berglund via fpc-pascal wrote: >I am working on a handler for IoT data from an electricity meter which >communicates via TTL serial at 115200 baud. It only sends data in packets of >less than 1 kbytes every 5-10 seconds. > >In order to validate the data I

[fpc-pascal] Calculating CRC16?

2022-10-25 Thread Bo Berglund via fpc-pascal
I am working on a handler for IoT data from an electricity meter which communicates via TTL serial at 115200 baud. It only sends data in packets of less than 1 kbytes every 5-10 seconds. In order to validate the data I need to check the CRC16 checksum at the end and here is where I don't find a