decimal to ascii for mathematical purposes
Hi,
I have a small problem where I am required to add the ascii values of characters but display the result as hex.
I am transmitting data via RS232, the data packet consists of 12 characters including line feed, carriage return.
Before transmitting the carriage return, I am required to include a checksum which is to be the sum of the ascii values of dataCharacter2 through to dataCharacter8.
E.G. if the packet was <LF> 1 1 1 1 0 4 5 1 1 0 <CR>, then the sum would be 15
The individual data is derived from separate functions and passed to a dataSend function. The code in the dataSend function is:
int checkSum = word2 + word3 + word4 + word5 + word6 + word7 + word8;
serialPort1->Write( checkSum );
I am sending out the data as shown above and I can see this via hyperterminal on a separate pc.
It writes the checkSum data as the decimal value of each character added up, not the ascii value of each character added up.
Can someone help me to add and send the data as the ascii values added please.

