none
Best way to communicate serially RRS feed

  • Question

  • I want create a method that will open a com port and send some data to the hardware connected and then return the response from the device.

    The problem is the device may take 100mS to respond or 10 Seconds and i dont want to leave the application waiting.

    Once the serial data received event is triggred what is the best way of getting this data where it needs to be?

    Second question is polling the device for a required response lets say we are checking its status for a change, is it acceptable to look at the response in the serial data received event method and if not correct request that status again? or is this going to spiral out of control?

    What is the best way of setting this up so i can send to the device and receive from it on from any of the forms in my application?
    Thursday, October 30, 2008 10:05 PM

Answers

All replies

  •  or is this going to spiral out of control?

    That I can probably answer: no, don't worry about it.

    To get your data where it should be depends on the data, what you want to do with it, ect. Consider a DataSet.

    Is the last question an invitation to post some code?

    AlexB
    Thursday, October 30, 2008 10:12 PM
  • no i was juts thinking aloud really - just wondering if there was an accepted way of doing things...

    Really I was wondering if i needed to run the coms on seperate thread to keep the application running smoothly
    Thursday, October 30, 2008 10:15 PM
  •  What else is your app doing? If it is busy with other things, then for sure: put it in a separate thread.
    AlexB
    Thursday, October 30, 2008 10:30 PM