title: Checksum Generation from sum of bits in python
body: <p>I am trying to control a chiller through RS232 with python. I am stuck at generating a checksum as required by the following method.</p>
  
  <p>"The checksum is two ASCII hexadecimal bytes representing the least significant 8 bits of the sum of all preceding bytes of the command starting with the sor." </p>
  
  <p>The "sor" in this case in bytes is "2E".</p>
  
  <p>-Example<br>
  For example, the PC requires the chiller mode be set to Stand By. It will transmit the following sequence of bytes. 
  2E 47 30 4135 0D </p>
  
  <p>Note that 2Eh is the start of header (“.”), 47h is the command (“G”), 30h is the qualifier to set the mode to Stand by.  41h and 35h are checksum bytes representing the ASCII hex for “A5” which is the least significant byte of the sum of 2Eh + 47h + 30h and 0Dh is carriage return.</p>
  
  <p>Does anyone know how to generate the checksum bytes 4135?</p>
  
  <p>Thankyou!!</p>