Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a serious problem with count checksum of fiscal printer.

Main rule is:

FF = FF xor hex1 xor hex2 xor hex3 (...)

and then I should get some hexadecimal value (two signs, for example B7).

Later this value (B7) I should spread on B and 7 and save it as hex (B as hex and 7 as hex).

I'm not good with hex so can anybdody write me some code in vb.net?

Thanks in advance.
Posted

There is no such thing as 'save as hex'. Hex is a representation. 10 Decimal and 0A hex are the same thing, written differently. So, unless you need to use string.Format to format your number visually as hex, the only issue you have is that you need to use bit masking to turn your number in to the two parts. You should explain what you mean by 'save as hex', do you need to literally save B and then 7, as characters ? If so, you can turn your number to hex and then split the string.
 
Share this answer
 
Christian - You have right, so let me explain:

i have some hex, for example: B7, A0, F2, C4.

Now I have to do something like that:

FF = FF XOR B7 XOR A0 XOR F2 XOR C4

and when I have value I must spread it on two characters (because this value will consist of two characters, right?), and convert them to hex. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900