title: SerialPort byte array always returning 0x63 on byte[5]?
body: <p>I have a program where I have data coming in through the serialPort, I convert this data into a byte array and then interrogate each byte. However, there are for example 6 bytes (byte[0] to byte[5]) which all mean various things. But for some reason the last byte (byte[5]) always returns a 0x63 in the program, even through the data coming into the port says something different. I have checked the data coming in with a scope to confirm the issues. Below is the relevant part of the code:</p>
  
  <pre><code>        SerialPort mySerialport = new SerialPort("COM3",9600, Parity.None, 8, StopBits.One);
          rxString = mySerialPort.ReadExisting();
          byte[] bytes = Encoding.ASCII.GetBytes(rxString);
          textbox1.Clear();
  
          if (bytes[0] == 0x12)                          //Header
          {
              if (bytes[1] == 0xA6)                      //Header
              {
                  if (bytes[2] == address)               //Address
                  {
                      byte A = bytes[3];
                      byte B = bytes[4];
                      var checksum = ((address + A + B) ^ 0xFF) &amp; 0xFF;
  
                      if (checksum == bytes[5])
                      {
                          textbox1.AppendText("Connected OK!!!");
                      }
                      else
                      {
                          textbox1.AppendText("Byte 5 = " + bytes[5]);
                      }
  
                  }
              }
            }
  </code></pre>
  
  <p>And what I notice, if I display my calculated Checksum in the textbox it is the same as the checksum on the scope (in Byte [5]). So it has to be in the code somewhere that the byte [5] is changing to 0x63.</p>
  
  <p>Thanks, your help is appreciated...</p>