i am receiving bytes from the serial port on my c# , and i am storing them in a byte array and then making them as string so now i need to convert the bytes to ASCII how i can do that? This is my code
void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) {
string bytestr = "";
int numbytes = serialPort1.BytesToRead;
byte[] rxbytearray = new byte[numbytes];
for (int i = 0; i < numbytes; i++)
{
rxbytearray[i] = (byte)serialPort1.ReadByte();
}
string hexvalues = "";
foreach (byte b in rxbytearray)
{
if (b != '\r')
hexvalues = hexvalues + (b.ToString()) + " ";
} // hexvalues = richTextBox1.Text;
Thread.Sleep(500);
MessageBox.Show(hexvalues);
}