Page 1 of 1

CRC16 of a string

PostPosted: Mon Jul 27, 2015 5:12 am
by DaveJ
Does anyone know of a routine or plugin that will do CRC16 Checksum of a string?
I have a serial device that has error checking and requires me to sum all the hex values ignore the most significant byte if it exists and change some bits.
I could do this manually but it needs to be performed every second so I don't think Neobook script will be fast enough.

Any ideas?
Many thanks
Dave J

Re: CRC16 of a string

PostPosted: Mon Jul 27, 2015 10:52 am
by Neosoft Support
I don't think there are any plug-ins for this, but you probably could create a VBScript function which might execute faster than one written in native NeoBook code.

Re: CRC16 of a string

PostPosted: Tue Jul 28, 2015 12:55 am
by DaveJ
Thanks Dave,
I have managed to get the firmware reprogrammed so it now doesn't use a checksum but will look into this as I'm sure it will come up again.

Thanks
Dave J

Re: CRC16 of a string

PostPosted: Tue Jul 28, 2015 8:24 am
by dpayer
Looks like someone has prepared the VBscript:

http://www.planet-source-code.com/vb/sc ... odeId=7219

The function will need to import the string from NB as a variable named psString and retrieve the calculated value from the VBscript named CalculateCRC. If the value is needed in Hex form, you could generate a new variable that was given the value Hex(CalculateCRC) before importing it back into NB.

If you need help preparing this, just ask. If you can create it, I suggest posting it on the Resource Center in the Functions section.

Re: CRC16 of a string

PostPosted: Tue Jul 28, 2015 10:22 am
by Tony Kroos
dpayer wrote:Looks like someone has prepared the VBscript:

It's not a CRC-16. It's a CRC-32 implementation.

Re: CRC16 of a string

PostPosted: Tue Jul 28, 2015 10:27 am
by David de Argentina
Some PowerBasic CRC16 functions:

http://www.powerbasic.com/support/pbfor ... ight=crc16

I think you could migrate any to VBScript, or if you need, i could create a plugin for you

Greetings from Buenos Aires,
David de Argentina

Re: CRC16 of a string

PostPosted: Sun Aug 16, 2015 2:13 pm
by DaveJ
Sorry I missed the other suggestions I didn't have email alerts switched on.
Many thanks for looking into the issue .

Dave J