title: How to: sending ASCII control characters in serial application
body: <p>Using the simple serial program created awhile back(<a href="http://csharp.simpleserial.com/" rel="nofollow">http://csharp.simpleserial.com/</a>) but I am having trouble sending ASCII control commands to my serial device. I need to send: 01P00104##. Is there a certain way to modify the code so that it sends out these “ASCII unprintable character commands” for C#?</p>
  
  <p>I tried:</p>
  
  <pre><code>      private void linkLabel_HC1_100_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
   {
          if serialPort1.IsOpen()
          { 
            serialPort1.Write( (char)2 + “01P00104##” + (char)3);
          }
    } 
  </code></pre>
  
  <p>Where (char)2 and (char)3 are supposedly the character representations for the start and end of text commands. I also tried using escape codes such as \u0002 or even sendKeys.Send(“^(b)”) or ^(c) but it wont seem to work. When I use Hyperterminal or PuTTy software, I can copy and past the full command in from a notepad.txt file and it sends correctly but when I copy and past the same code into this application, I don’t get a response from the serial device. This app uses .net 2.0. The stx and etx commands in the notepad look like a small 7 and small L</p>