Zamiana znakow na HEX lub ASCII

0

Witam,
w jaki sposób najszybciej zamienić znak w C# na ASCI lub HEX i wysłać przez serialport?
Chce wysyłać przez serial port 3 bajty, aby sterować kamerą.
Link do protokołu:
http://www.meritlilin.co.uk/assets/LILIN_PIH-7000,_PIH-7600,_PIH-7625_Series_Fast_Dome_Camera_Protocol.pdf

0
string input = "Hello World!";
char[] values = input.ToCharArray();
foreach (char letter in values)
{
    // Get the integral value of the character.
    int value = Convert.ToInt32(letter);
    // Convert the decimal value to a hexadecimal value in string form.
    string hexOutput = String.Format("{0:X}", value);
    Console.WriteLine("Hexadecimal value of {0} is {1}", letter, hexOutput);
} 
/* Output:
   Hexadecimal value of H is 48
    Hexadecimal value of e is 65
    Hexadecimal value of l is 6C
    Hexadecimal value of l is 6C
    Hexadecimal value of o is 6F
    Hexadecimal value of   is 20
    Hexadecimal value of W is 57
    Hexadecimal value of o is 6F
    Hexadecimal value of r is 72
    Hexadecimal value of l is 6C
    Hexadecimal value of d is 64
    Hexadecimal value of ! is 21
 */
0

Wait a minute. Wytłumacz się dlaczego chcesz zamieniać na ASCII lub HEX. Spojrzałem na ten protokół i nie oczekuje się tam na przykład litery 'B'

1 użytkowników online, w tym zalogowanych: 0, gości: 1