LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-11-2008, 07:37 PM   #1
cwedison
LQ Newbie
 
Registered: Sep 2007
Posts: 1

Rep: Reputation: 0
Books on serial port programming?


Does anyone know of any books on serial port programming that covers programming in C in Linux?
 
Old 01-11-2008, 09:58 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Quote:
Originally Posted by cwedison View Post
Does anyone know of any books on serial port programming that covers programming in C in Linux?
The concept of serial port programming (or any hardware port) being described in terms of a programming language seems strange to me. That sort of information comes from hardware specification books and books that describe the communications protocol. The programming language is irrelevant. In any case it has to be a low level language which means either assembly or C with perhaps some assembly subroutines mixed in.

I own a book which explains serial port specifications and communications protocols. It is called "The Modem Reference", second edition, by Michael A. Banks, ISBN 0-13-589862-5, published in 1991. The book explains how to communicate with a modem on a serial port. If the device that you want to communicate with is not a modem then you will also need the hardware specifications of the device that you want to use on the serial port.

If you want a programming example of using a serial port look at the Linux kernel's code for a generic dial-out modem.

-----------------------
Steve Stites
 
Old 01-11-2008, 10:34 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,647
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
"The serial port" is simply a character device. You can open that device and read it or write to it, and whatever you do there affects the corresponding port.

Also note that every thing you are likely to need to do with a serial port has already been done by some library, language or tool that already exists. You do not need to get anywhere close to "the bare metal" in doing serial communications.
 
Old 01-12-2008, 06:09 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
There certainly is some linux (UN*X) specific ioctl stuff on serial ports, and the termios API.
Here is a serial programmning HOWTO for linux. And this more helpful (half) free eBook
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
serial port programming sundaresh Programming 6 07-19-2007 08:32 AM
serial port programming: Java or C? ar1 Programming 5 05-19-2005 02:55 PM
programming to 'real' serial port in C++ microsoft/linux Programming 3 03-15-2005 08:12 AM
serial port programming!!! novice_din Programming 4 02-03-2005 08:50 PM
Programming the Serial Port karans Linux - Networking 2 11-03-2003 01:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration