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-17-2006, 12:38 AM   #1
swatisameerp
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Rep: Reputation: 0
How to handle interrupts in C


Hello,
I want my program should trigger an interrupt when the data is received on the serial port.
Please tell me how to handle this in C or C++.

thanx
 
Old 01-17-2006, 08:20 AM   #2
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
register a signal handler for the signal that is generated when there are some operations or data flow in the desired serial port.

Hope this helps.
 
Old 01-17-2006, 11:37 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Use sigaction() to catch a SIGIO signal on the filedescriptor that has the serial port open (e.g. /dev/ttyS0), or see this thread for this thread for an example how to have your program sleep until the serial port needs attention.

Last edited by Hko; 01-17-2006 at 11:39 AM.
 
  


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
Interrupts rhcohen Programming 5 12-21-2017 11:25 AM
BIOS Interrupts Orkie Programming 3 04-22-2005 09:23 AM
howto handle interrupts in linux cheema Programming 3 07-08-2004 01:44 AM
about interrupts eshwar_ind Programming 1 02-25-2004 12:38 AM
High interrupts dunkyb Linux - General 4 12-29-2003 08:04 PM

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

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

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