Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two programs controlling one separate device serial port

Status
Not open for further replies.

norason

Programmer
Jan 28, 2009
139
US
Our system has the following equipment:

1 device with 1 serial connection (RS422)
1 PC with a VB6 program that was initially designed to hook up directly to the RS422 device.
1 Pc with a different VB6 program that was initially designed to hook up to the RS422 device.
1 Ethernet to Serial black box.
2 Serial to Ethernet diverter programsm, one in each PC.

What we need to do is allow both PC's to communicate with the RS422 device at the same time. The problem is that when one PC has the port open, the other PC can't talk to it. If we design one of the PC programs to not open the port, just listen, that might work, but when we wanted to use that program only, we wouldn't open the port.

Is there any way to allow both PC's access to the single RS422 port on the devicce?

norason
 
I don't think so.

Perhaps you could consider a kind of 'time-sharing' solution where the two PCs communicate with each other and only use the device for a minute at a time, then relinquish the device to the other PC. It depends whether both PCs need to listen to the device all the time.

The other solution might be to use a third PC connected to the device that takes commands issued by the other two PCs into a FIFO buffer and sends them to the device, and likewise dumps any information coming out of the device into a FIFO list that both machines can read. In other words it's a bit like having a server application that takes requests from workstations and processes them in the order they're received.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
AndyGroom,

The first suggestion won't work since the one program must constantly listen for data.

I'll kick around the second suggestion. Thanks.

norason
 
If the device and the computer program can be configured to use RS485 you can hook up a number of devices and computers all on the same line.

RS422 is +/- 12 Volt system that only 2 can talk between because the receiving computer provides the voltage.

RS485 is a 0 to up to 12 volt system with all listeners high impedance and any transmitting pulls the line from 12 down to 0 volts so you can have many computers listening on the one line.

Each station has an ID and it is up to the program to decide which data goes where.
You would need a RS232 to RS485 adapter for each computer.

Alternatively-
You can purchase a cheap RS232 sniffer monitoring adapter so one computer can listen across the line to the transmissions of the main computer or the device. Both computers can listen but only one can send.

Alternatively-
Always have one computer connected to the device and use the LAN & Winsocks or a second RS232 port to communicate to the other computer so it can send and receive data to the device via the first one (this is really quite easy)

 
Tedsmith,

Thanks for the suggestions - we're considering them all.

norason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top