Check out the Serial HOWTO: http://www.linuxdoc.org/HO
Main Topics
Browse All TopicsHow do you read and write to a serial port under Linux?
Where can I find examples? I am new to Linux and my reference books dont mention serial io at all. Under windows the steps were:
1. configure the port.
2. open a file corresponding to the port
3. write a read thread that looped about endlessly hoping for input.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Check out the Serial HOWTO: http://www.linuxdoc.org/HO
Hi,
The details of serial programming are avilable on your Linux itself.see the HOWTO pages in /usr/doc .in this,you'll find something called serialprogramming-HOWTO.yo
In Linux,the steps to follow are:
1)Check the Serial device(eg./dev/ttyS1),weth
2)If free,open the port and set the attributes using functions tcgetattr and tcsetattr,use the port.
3)Close the port after done.
Thanx ;-)
Jit
Hi
This is a sample program for setting your comport.
Then you will be able to write to habdle( global var )
Sincerely, Siamak
static void CommunicationSetting(){
struct termios tio ;
int i ;
unsigned char buf[30];
char TMP[50],TMP1[20];
i=0;
sprintf( buf, "/dev/tty%da", Data.Config.Settings.ComPo
portHandle= open( buf, O_RDWR| O_NONBLOCK| O_NOCTTY) ;
if( portHandle==-1 )
{
perror( buf) ;
CONP_("\nDaemon : Error in communication port !");
return ;
}
tcgetattr( portHandle, &tio) ;
sprintf(TMP,"\n\n\n\nprevl
CONP_(TMP);
i =tio.c_cflag & 00777760 ;
i |=B2400 | CSTOPB | CS8 ;
i &= ~(CLOCAL) ;
tio.c_cflag = i;
tcsetattr( portHandle, TCSANOW, &tio) ;
tcgetattr( portHandle, &tio) ;
sprintf(TMP, "\n\n\n\n(%s)line attribute: %o\t%o\t%o\t%o\n",TMP1, tio.c_iflag, tio.c_oflag, tio.c_cflag, tio.c_lflag ) ;
CONP_(TMP);
}
Business Accounts
Answer for Membership
by: JohnSpoonerPosted on 2000-12-06 at 08:03:04ID: 981
let me know if this is a harder qustion than i think