LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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
 
LinkBack Search this Thread
Old 06-08-2006, 02:31 AM   #1
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Rep: Reputation: 30
Best way to program a simple serial routine


I need to write a piece of software to do the following:

1. Sends a byte through a serial port (triggers an external device to send a reply).
2. Receives a byte from the serial port. This byte is then written to a file.

I've been coding my whole project in bash scripts and perl and don't want to have to learn another language if possible. Can anyone recommend the best way to solve this problem? Any code to setup the serial port would also be appreciated.

Thanks
 
Old 06-13-2006, 12:49 PM   #2
Theorist
Member
 
Registered: Jun 2006
Distribution: FC5, FC3, RHEL 3, Debian 3.1, Debian 3.0
Posts: 56

Rep: Reputation: 15
Hi nutthick,
I believe you know C. If you don't, then learn it. You can write a C program to read and to write to a serial port.

Two good references that I would suggest will be : -

1.) Serial Programming HOWTO by Gary Frerking available in http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/

2.) Serial Programming Guide for POSIX Operating Systems by Michael R. Sweet which can be downloaded from his site which is http://www.easysw.com/~mike/serial/

Both of them discusses the Input/Output concepts of serial devices well. I am sure you will definitely find them interesting.

With Regards,
Theorist

Last edited by Theorist; 06-13-2006 at 01:06 PM.
 
Old 06-20-2006, 01:15 AM   #3
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Original Poster
Rep: Reputation: 30
Thanks Theorist, C did it without any problems.
 
  


Reply

Tags
com, port, serial


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hash routine into assembly program rblampain Linux - Security 3 08-06-2005 01:49 AM
Serial setup program os2 Programming 6 03-23-2005 11:34 AM
C++ serial port program problem doar Programming 3 10-01-2004 10:46 AM
Unable to hit my serial port interrupt routine hguts Linux - Software 1 07-15-2003 07:45 AM
Simple Serial Connection Bloughry Linux - General 0 09-20-2001 06:17 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration