serial programming

bridged with qdn.public.qnxrtp.applications
Post Reply
Kevin Weisser

serial programming

Post by Kevin Weisser » Wed Jun 05, 2002 10:22 pm

I have two computers hooked up through a non modem line and I am attempting
to send input from from computer to the other over the serial port and vice
vera right now in my program I open the serial port up and then I do a read
command and output that my have arrived from the other computer then i scan
in characters and write them out over the fd associated with the serial
line. Is there anything wrong with this logic and also I am still trying to
get the info to send as soon as it is typed as opposed to waiting for a
return key to be pressed

Thoma

Re: serial programming

Post by Thoma » Thu Jun 06, 2002 1:54 pm

Kevin Weisser <kweisser@udel.edu> wrote:
I have two computers hooked up through a non modem line and I am attempting
to send input from from computer to the other over the serial port and vice
When you say non modem line do you mean a NULL modem line? If not
you will need a null modem in there so the TX and RX (and other control lines)
get swapped from one PC to the other.

And the simple test would be

on a cat > /dev/ser1
on b cat < /dev/ser2

and you can use

stty -a < /dev/ser1

to view information about the port to make sure they are the same baud rate and
such

Tom

David Gibbs

Re: serial programming

Post by David Gibbs » Fri Jun 07, 2002 2:14 pm

Kevin Weisser <kweisser@udel.edu> wrote:
I have two computers hooked up through a non modem line and I am attempting
to send input from from computer to the other over the serial port and vice
vera right now in my program I open the serial port up and then I do a read
command and output that my have arrived from the other computer then i scan
in characters and write them out over the fd associated with the serial
line. Is there anything wrong with this logic and also I am still trying to
get the info to send as soon as it is typed as opposed to waiting for a
return key to be pressed
The sent immediately vs waiting for return to be typed is controllable.
Take a look at some of the other threads in this group, for instance
the thread that talks about raw() and unraw() and the effects they
have.

As to "typing", if you're not typing directly on a true serial
terminal, what is probably controlling when the characters are
sent is, actually, the input side, that is, how whatever program
is getting things from your console is setting things up. Again,
look at the raw/canonical mode for that input too.

stty can be used to control many of these settings from the
command line, instead of doing it programatically. You might
try "stty +raw" and "stty +edit" for changing modes on your
input device.

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

Post Reply

Return to “qdn.public.qnxrtp.applications”