-   Programming (
-   -   Best way to program a simple serial routine (

nutthick 06-08-2006 03:31 AM

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.


Theorist 06-13-2006 01:49 PM

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

2.) Serial Programming Guide for POSIX Operating Systems by Michael R. Sweet which can be downloaded from his site which is

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

With Regards,

nutthick 06-20-2006 02:15 AM

Thanks Theorist, C did it without any problems.

All times are GMT -5. The time now is 06:25 PM.