Sorry for the delay, but I was in the delegation.
The description of BCC in the manual (translated from original Spanish) is as follows:
BCC = Four hexadecimales. Binary sum of all prior bytes
In my opinion the binary sum of all bytes is nothing but the sum of the ASCII codes of each character in the string.
From a mathematical point of view, it does not matter if we add up the number of binary, hexadecimal or decimal notation. The sum should always be the same.
the sum in binary notation : 101 + 110 = 1011; decimal = 11
the sum in decimal notation: 5 + 6 = 11
I'm surprised the given example, because the sum of all bytes (from [STX] to [ETX]) results in a hexadecimal notation 0554, not 0054.
Example according to andyglezl
DecToHexa (BIntODEC (DecToBin (asciisum ("123"))))
is OK, but shorter is NTOC( AsciiSum ( cSent ), 16, 4, '0' )
Code: Select all
BCC:=NTOC( AsciiSum ( cSent ), 16, 4, '0' ) // => '0554'
Manufacturer fiscal printer does not provide any libraries to operate the device?