Find the answer to your Linux question:
Results 1 to 2 of 2
I am developing an application in c with Linux OS, where a radio modem working at baud rate 9600 will be attached to PC on serial port. More than four ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    1

    Serial port programming

    I am developing an application in c with Linux OS, where a radio modem working at baud rate 9600 will be attached to PC on serial port. More than four such units will be communicating at one time, so there may be jamming or data corruption. Each module will be transmitting Data packets less than 500 bytes.
    How should I set my serial port and program my application so that I can receive packets correctly.
    Your suggestions will be welcomed

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Programming serial ports isn't a black art, and it's not even rocket science. But it can be difficult to understand at first.

    Do these two commands at the shell prompt:
    Code:
    man tcgetattr
    man tcsetattr
    If those man pages are not installed on your system, do a google search for each of these sets of terms:
    Code:
    linux man tcgetattr
    linux man tcsetattr
    There's a lot of information on those man pages, and it's no picnic gathering it all into a program that works.

    It turns out that I've written a sample program that you might wish to examine. It's here. I wrote this application to communicate with a modem, but you can ignore the parts you don't need. It's insanely well documented if I say so myself. :)

    I will leave that source code there for at least two weeks.
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...