Serial Communication (RS-232)

I have a computer linked to an instrument via RS-232.
On the computer, the software controlling the instrument is sending
commands to the instrument and retreiving the data from the instrument.
Somehow, I need to be able to treat this data live, but I cannot 1) stop the software 2) modify its code
Using an Hyperterminal-like program, I was able to "monitor" the communication between the software and the instrument. i.e. see the data being sent back to the software. Eventually, this causes a communication failure between the software and the instrument. I'm guessing that the instrument is maybe receiving queries from both the software and hypertermal at the same time (although I'm actually not typing anything in hyperterminal).
Anyway the question is: Would there be a way to run another program (e.g. a matlab script) in parallel with the software and that could "listen" to the com port (without interfering) ?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Euh wrote:

Reading a serial port from two programs will not work - the one program will see some of the data, the other program the rest. I'm not surprised the control software got confused.
To get a copy of the instrument data you can either 'snoop' on the physical cable, intercept the data at system level, or run the link through a software or hardware pass-through device.
In hardware: make up a T-cable, connecting the TxD from the instrument to RxD of a second COM port, and let your application read from the second COM port. This might or might not work, depending on how solid the RS-232 port of the instrument is.
There are plenty free and commercial tools available, e.g. <http://technet.microsoft.com/en-us/sysinternals/bb896644 (google for "com port monitor")
If you feel comfortable writing a little application: make an interceptor program that opens two serial ports, and copies all data from port 1 to port 2 and vice versa. While it is doing that, it can write the data to a file, pipe, socket, other virtual com port, or whatever your application can read from.
The 'interceptor' program can run on a second computer using physical ports, like
[instrument]-----[com1 <intercept> com2]-----[com1 <- control]
or using virtual comports like
[instrument]-----[com1 <intercept> vcom <- control]
Virtual ports is probably the easiest to set up, use something like <http://www.ant.uni-bremen.de/whomes/rinas/nullmodem/ or (if you're stuck with windows) <http://com0com.sourceforge.net/
j
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Thanks, Jack. This was great information.
dg
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.