• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calculing the Checksum and adding it to the outputstream

 
Jaume Guillamon
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm having problems for calculating the checksum of a message that aI have to send to a serial port.

I don't understand the manual and I don't know how to do it.

I have a method that send the message to the Outputstream including the STX and ETX but I don't know how to include the checksum.

Here is what I have:




Reading the manual I have this information:

The standard LRC is calculated using a seed value of 0, and bitwise XORing each byte following the STX, including the ETX. This value is transmitted as a single ASCII character immediately following the ETX as the fincal character of the record.


Any of you can help me ? I 'm really lost.....

Thank you in advance for your help.
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Paul pointed out in your previous post, bytes and Strings are different things. Converting them back and forth is a Bad Idea.
Have you tried to calculate the checksum? The Java Tutorial covers bitwise operations. What more do you need to know?
 
Jaume Guillamon
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I have solved with your help the send of bytes. I will work with bytes now.

Here the Method:


[ October 30, 2007: Message edited by: Jaume Guillamon ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!