robsuttonjr
MIS
I am having trouble getting the CRC-16 value I know I should get for a PTI voice pick code. I tried this:
?SYS(2007,"1085051000201146587443HG234",-1,0)
which returns: 59341 (0x9F9E)
the value I want is: 26359 (0x66F7)
This is the string value I am passing: "1085051000201146587443HG234"
I went to this site to get the data pasted below:
From the site above I get the value I seek but I want to do this in native FoxPro. It seems that the SYS(2007) is using CCITT.
"1085051000201146587443HG234"
1 byte checksum 137
CRC-16 0x66F7 *** This is the value I want
CRC-16 (Modbus) 0x8F90
CRC-16 (Sick) 0xB458
CRC-CCITT (XModem) 0x9F9E ** This is the value that FoxPro SYS(2007) gives me
CRC-CCITT (0xFFFF) 0xE7CD
CRC-CCITT (0x1D0F) 0x74F8
CRC-CCITT (Kermit) 0x6A3E
CRC-DNP 0x9288
CRC-32 0xC022DBE4
Here is the info gathered some info from:
Help Formulating a Voice Pick Code
How do i accomplish the following? i found the "Directions", but they are way above me.
i need to calculate a 4 Digit code from a string of numbers and characters.
--------------- Directions from online -----------------------
Compute PlainText.
a. PlainText is the 14 digit GTIN appended by the Lot Code and the Date (where present).
b. Do not include the application identifier prefixes or parentheses.
c. There are no spaces between the GTIN, Lot and Date fields.
d. Date if present is represented as YYMMDD with zero packing and no '/' characters.
Compute ANSI CRC-16 Hash of the PlainText ASCII bytes using the standard ANSI CRC-16 hash with the polynomial of X16 + X15 + X2 + 1
Compute the VoiceCode by from the Hash by taking the 4 least significant digits in decimal form (Hash mod 10000)
---------------------- Example: --------------------
GTIN = (01) 10850510002011
Lot = (10) 46587443HG234
PlainText = 1085051000201146587443HG234
VoiceCode = 6359
Large Digits = 59
Small Digits = 63
Regards,
Rob
?SYS(2007,"1085051000201146587443HG234",-1,0)
which returns: 59341 (0x9F9E)
the value I want is: 26359 (0x66F7)
This is the string value I am passing: "1085051000201146587443HG234"
I went to this site to get the data pasted below:
From the site above I get the value I seek but I want to do this in native FoxPro. It seems that the SYS(2007) is using CCITT.
"1085051000201146587443HG234"
1 byte checksum 137
CRC-16 0x66F7 *** This is the value I want
CRC-16 (Modbus) 0x8F90
CRC-16 (Sick) 0xB458
CRC-CCITT (XModem) 0x9F9E ** This is the value that FoxPro SYS(2007) gives me
CRC-CCITT (0xFFFF) 0xE7CD
CRC-CCITT (0x1D0F) 0x74F8
CRC-CCITT (Kermit) 0x6A3E
CRC-DNP 0x9288
CRC-32 0xC022DBE4
Here is the info gathered some info from:
Help Formulating a Voice Pick Code
How do i accomplish the following? i found the "Directions", but they are way above me.
i need to calculate a 4 Digit code from a string of numbers and characters.
--------------- Directions from online -----------------------
Compute PlainText.
a. PlainText is the 14 digit GTIN appended by the Lot Code and the Date (where present).
b. Do not include the application identifier prefixes or parentheses.
c. There are no spaces between the GTIN, Lot and Date fields.
d. Date if present is represented as YYMMDD with zero packing and no '/' characters.
Compute ANSI CRC-16 Hash of the PlainText ASCII bytes using the standard ANSI CRC-16 hash with the polynomial of X16 + X15 + X2 + 1
Compute the VoiceCode by from the Hash by taking the 4 least significant digits in decimal form (Hash mod 10000)
---------------------- Example: --------------------
GTIN = (01) 10850510002011
Lot = (10) 46587443HG234
PlainText = 1085051000201146587443HG234
VoiceCode = 6359
Large Digits = 59
Small Digits = 63
Regards,
Rob