I'm writing a program that needs to communicate with a device by the serial port.
The communication protol requires me to place a checksum behind every command I send to the device.
For example : when I want to send the command :I
I have to calculate the checksum, wich is 0x00 - 0x49 - 0x3A
This is 0 minus the hexvalue of the ascii-code for the first byte (I) minus the hexvalue of the ascii-code for the second byte (
The result should be 7D (0x37 0x44)
Because it's not possible to do math operations on Hex numbers in Windev, i'm doing the calculation in Decimal values, wich is 0 - 73 - 58
the result is now -131, when I use a mathematical calculator to convert this to Hex, again I get 7D, wich is correct.
My problem now, how can I convert a negative decimal number into Hex in Windev ? The code that the wizzard generates, only works for positive numbers, but I want to be able to do this with Negative numbers also.
Any suggestions from the math-wizzards here ? Becaus math is not really my thing
Greetz,
Patrick