how to capture and store serial communication data in buffers

This is a discussion on how to capture and store serial communication data in buffers within the C Programming forums, part of the General Programming Boards category; I sent 1preample and 4bytes in transmitting side , preample contains only 1 and 0 with 4milliseconds delay, each byte ...

  1. #1
    Registered User
    Join Date
    Jun 2013
    Posts
    1

    how to capture and store serial communication data in buffers

    I sent 1preample and 4bytes in transmitting side , preample contains only 1 and 0 with 4milliseconds delay, each byte contains 8bits with 2milliseconds delay , if a bit contains 1 it will send 1millisecond high and 1millisecond low signal ,and if a bit contains 0 it will send 2millisecond continuous delay, I have a problem at receiving side how to capture and store the preample and 4byte values in a buffer , iam using ARM processor it will update every 5microsecond .. please guide me and give a valuable suggestions

  2. #2
    Registered User
    Join Date
    Apr 2013
    Posts
    1,340
    Is this protocol that your are using a fixed protocol or are you allowed to change it? Also I'm assuming your program samples the input line while looping. The program should wait for a 1 to appear for 2.5 milliseconds or longer, then wait for the 1 to transition to a 0. After the transition to 0, the program should wait for 4.5 milliseconds so that the next sample occurs in the .5 milliseconds into the first data bit. After that it should delay 2 milliseconds between sampling in order to keep sampling at .5 milliseconds of each data bit period.

    If the protocol can be changed, then the conventional method is for the transmitting line to be zero when not transmitting. It should then transmit a 1 as a start bit, then transmit 8 bits of data, then transmit a 0 as a stop bit. All bits are transmitted with the same time period, using your example 2 milliseconds. The program polls until it sees a 1, which is the start bit, then it delays 3 milli-seconds to sample the next 8 data bits in the middle of each data bit period. It may also want to sample the stop bit to verify that bit as well.

    Note this polling method is mostly for a half duplex protocol, where data is only transmitted in one direction at a time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. store data from ifstream and store in link list
    By peter_hii in forum C++ Programming
    Replies: 2
    Last Post: 10-26-2006, 09:50 AM
  2. Serial Communication in C++
    By NewGuy100 in forum C++ Programming
    Replies: 8
    Last Post: 04-24-2006, 02:56 PM
  3. C Serial Communication BCD
    By ZoomCities in forum C Programming
    Replies: 1
    Last Post: 10-13-2005, 08:00 PM
  4. Need some help with Serial Communication
    By vsriharsha in forum C Programming
    Replies: 1
    Last Post: 02-25-2002, 09:11 AM
  5. Serial Communication
    By Unregistered in forum C++ Programming
    Replies: 0
    Last Post: 01-17-2002, 08:36 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21