RS-232 Serial Port

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 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.

Do I have to include the driver in my program?

What do you mean include?

David Choi wrote:

Do I have to include the driver in my program?

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?

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?
\

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?


\