RS-232 Serial Port

bridged with qdn.public.devtools
Post Reply
David Choi

RS-232 Serial Port

Post by David Choi » Wed Nov 13, 2002 9:56 pm

I am having trouble communicating with the RS-232 in QNX. I think the
correct way is to use open() and read() on "dev/ser1" but I can't find the
drivers for RS-232. I need to be able to read individual characters that
are coming in through the port. Is there an example program I could see
somewhere? Thanks!

David Gibbs

Re: RS-232 Serial Port

Post by David Gibbs » Wed Nov 13, 2002 10:36 pm

David Choi <d-choi2@northwestern.edu> wrote:
I am having trouble communicating with the RS-232 in QNX. I think the
correct way is to use open() and read() on "dev/ser1" but I can't find the
drivers for RS-232. I need to be able to read individual characters that
are coming in through the port. Is there an example program I could see
somewhere? Thanks!
The driver is in the family devc-ser*. They are generally handled
with open(), read(), and the (Posix) family of tc* functions. It is
possible to read a character at a time as they come through the port.

_Advanced Programming in the Unix Environment_ by W. Richard Stevens
has a good chapter on handling terminal devices that is applicable to
QNX as well.

Or, for something far less comprehensive, you can take a look at the
library docs for: tcstattr(), tcgetattr(), tcflow(), te3rmios structure,
tcflush(), etc. But, this material is reference rather than tutorial
or explanatory.

readcond() is a QNX only function that also gives a far simpler
interface to some of these parameters than the tc* functions, but
is not portable. (If you were asking for QNX4, the closes match
would be dev_read().)

-David
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

David Choi

Re: RS-232 Serial Port

Post by David Choi » Thu Nov 14, 2002 6:37 am

Do I have to include the driver in my program?

Kit Plummer

Re: RS-232 Serial Port

Post by Kit Plummer » Thu Nov 14, 2002 4:27 pm

What do you mean *include*?

David Choi wrote:
Do I have to include the driver in my program?

Jens H Jorgensen

Re: RS-232 Serial Port

Post by Jens H Jorgensen » Thu Nov 14, 2002 4:35 pm

No - all the functions refered to are standard C-library functions.

You might have to include certain header files.
--
Jens

"David Choi" <d-choi2@northwestern.edu> wrote in message
news:aqvfta$9em$1@inn.qnx.com...
Do I have to include the driver in my program?

David Choi

Re: RS-232 Serial Port

Post by David Choi » Thu Nov 14, 2002 5:53 pm

That's what I meant by include. Which header files do I need to include?

"Jens H Jorgensen" <jhj@remove-nospam-videk.com> wrote in message
news:ar0ivr$hve$1@inn.qnx.com...
No - all the functions refered to are standard C-library functions.

You might have to include certain header files.
--
Jens

"David Choi" <d-choi2@northwestern.edu> wrote in message
news:aqvfta$9em$1@inn.qnx.com...
Do I have to include the driver in my program?



Jens H Jorgensen

Re: RS-232 Serial Port

Post by Jens H Jorgensen » Thu Nov 14, 2002 6:39 pm

termios.h
unistd.h

are probably the ones you need. Do a grep in /usr/include for you function
names.

--
Jens
"David Choi" <d-choi2@northwestern.edu> wrote in message
news:ar0nho$mv0$1@inn.qnx.com...
That's what I meant by include. Which header files do I need to include?

"Jens H Jorgensen" <jhj@remove-nospam-videk.com> wrote in message
news:ar0ivr$hve$1@inn.qnx.com...
No - all the functions refered to are standard C-library functions.

You might have to include certain header files.
--
Jens

"David Choi" <d-choi2@northwestern.edu> wrote in message
news:aqvfta$9em$1@inn.qnx.com...
Do I have to include the driver in my program?





Post Reply

Return to “qdn.public.devtools”