Testing Serial program using same port

Rs-232 / Serial port
August 26, 2009 at 06:00:32
Specs: Linux Fedora 6, 686/2gb
I have a colleague trying to use a program to write/read data to/from the same serial port on the same machine.

I've never attempted such a thing (I've done different ports/same machine, different machines,etc.)

Is this behavior defined? It appears to write correctly, but when the time comes to read it, it appears to be able to read the same information multiple times.


See More: Testing Serial program using same port

Report •


#1
August 26, 2009 at 15:11:17
There is no reason you can't read and write from the same
serial port. That's what it does normally. If doing your own
software make sure that the port is initialized properly and
proper handshaking is installed.

Report •

#2
August 26, 2009 at 15:40:09
You can check the hardware with a loopback tester.

http://zone.ni.com/devzone/cda/tut/...

Skip


Report •

#3
August 26, 2009 at 17:00:29
Depends exactly you what you mean by send and recieve at the same time. RS232 serial ports don't do full duplex. They will only do half duplex.

This means that they will recieve then switch to transmit mode and transmit and then back into recive mode.

All this is controlled by the DTR (Data Terminal Ready - the computer) and DRS (Data Set Ready - the modem or whatever is plugged into the serial port) along with the RTS (Request to Send) and CTS (Clear to Send) lines. DTR and DSR are usualy initialsied as the start of a session and RTS and CTS are constantly changing during the session. It is up to the software to control them.

Stuart


Report •

Related Solutions

#4
August 26, 2009 at 18:05:19
Oddly enough there really is two data lines on a comm port . I have never heard of anyone or any application using the second set.

Playing to the angels
Les Paul (1915-2009)


Report •

#5
August 26, 2009 at 18:32:35
The second set of data lines were used with synchronous communications. Most RS232 communications were asychnchrounous.

Synchronouse communications needed all 25 pins of the RS232 standard; you couldn't do it with just nine pins. I never came across any applications that used synchrounouse communications either but I imagine there were some out there. I think it was only ever used with dumb terminals communicating with a mainframe.

Stuart


Report •

#6
August 26, 2009 at 21:20:12
By send and receive at the same time, I mean write to the file descriptor and have a sigio handler assigned to read. He's not using either S/W or H/W flow control.

Report •


Ask Question