C# Serial Port Communication RRS feed

  • General discussion

  • Got it

    • Moved by Chester Hong Tuesday, February 26, 2013 7:11 AM
    • Edited by N00b C Tuesday, February 26, 2013 3:44 PM
    • Changed type Mike Feng Wednesday, February 27, 2013 2:07 PM
    Monday, February 25, 2013 9:14 PM

All replies

  • Hi N00b C,

    This is a SerialPort question according to your description. I would like to move your thread to .NET Framework Class Libraries forum to get more response.

    Thanks for your understanding and support.

    Best regards,

    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 26, 2013 7:11 AM
  • your code looks fine, however just confirm the wiring of the device attached to serial port.

    TLP-> can you explain on this.

    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora

    Tuesday, February 26, 2013 7:27 AM
  • I agree with RohitArora. Your code looks OK except for a minor detail. When you use Invoke (instead of BeginInvoke) remember to close the port from a different thread to avoid a possible deadlock as explained in chapter "SerialPort Receive" of my SerialPort tutorial.

    Besides, since you only use the standard delegate (EventHandler) to "wake" a method on the UI thread and doesn't need information about the caller, you can optimize your code a little by using the standard delegate MethodInvoker instead.

    Everything should be made as simple as possible, but not simpler. Any fool can write code that a computer can understand. Good programmers write code that humans understand.

    Tuesday, February 26, 2013 8:33 AM