Thread: Implementing a simple transfer protocol

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    85

    Implementing a simple transfer protocol

    I'm on my quest on building a digital scope with a microcontroller on the serial port and c++.

    The code on the uc is written, and will need various adjustments, now comes the real hard part - implementing a PC side software.

    I'm thinking of how to send and process the data. Basically, I send at first two bytes, one which will tell the IC how many pins will be read, and then another byte for "start".

    Then, the uc sends ascii 65 (packet start), then two characters for each pin's value, then ascii 90 (packet end).

    I'm thinking of enhancing the protocol. Surely, there will be missed bytes, which will render this bad. How exactly can I detect when there will be skipped bytes, and how should the software react?

    For the moment, I'm thinking of adding a "time" value to each sample, so in case a few samples are missed, the current sample is added a bit ahead of the last good one, and the missed data can be marked as bad, or it can be interpolated.

    I'm also thinking - should I buffer all this data? I'm thinking the best way to do it this way is a circular/ring buffer. Another idea is using a fixed size deque as a buffer. And there's also a standard class for the last one.
    Last edited by _izua_; 09-04-2007 at 11:02 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implementing IRC protocol
    By cs_student in forum Networking/Device Communication
    Replies: 6
    Last Post: 07-14-2009, 11:25 AM
  2. Simple Socialising Chat Bots
    By bengreenwood in forum C++ Programming
    Replies: 10
    Last Post: 11-28-2007, 08:42 AM
  3. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM
  4. help on protocol
    By Prasad kulkarni in forum C Programming
    Replies: 3
    Last Post: 10-20-2002, 08:54 AM
  5. speakers
    By Unregistered in forum C Programming
    Replies: 12
    Last Post: 03-31-2002, 08:57 AM