Yes. In your example, the first 2 PLCs need to be connected to the same MPI bus. You can connect to both using
testMPI --mpi2=3 <serialPort>
testMPI will only do a few things with the second PLC. To change PLCs, you would have to type:
testMPI --mpi=3 --mpi2=2 <serialPort>
Which will make 3 the first PLC.
Look into the code to see how:
- two daveConnections are created with the same daveInterface
- daveConnectPLC is invoked on both of them to connect the individual PLCs
For your third PLC, just create an second daveInterface using a socket opened with the PLCs IP and daveProtoISO_TCP.
Then create your third daveConnection using this daveInterface. You can simply copy in the lines from testISO_TCP.c and modify the variable names so that they will not conflict with the existing names.
Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
is it possible to connect to more than one PLC at the same time using a serial port?
E.g.
PLC_A: MPI-Adr.: 2,
PLC_B: MPI-Adr.: 3,
PLC_C: TCP-Adr.: 198.162.1.10
Yes. In your example, the first 2 PLCs need to be connected to the same MPI bus. You can connect to both using
testMPI --mpi2=3 <serialPort>
testMPI will only do a few things with the second PLC. To change PLCs, you would have to type:
testMPI --mpi=3 --mpi2=2 <serialPort>
Which will make 3 the first PLC.
Look into the code to see how:
- two daveConnections are created with the same daveInterface
- daveConnectPLC is invoked on both of them to connect the individual PLCs
For your third PLC, just create an second daveInterface using a socket opened with the PLCs IP and daveProtoISO_TCP.
Then create your third daveConnection using this daveInterface. You can simply copy in the lines from testISO_TCP.c and modify the variable names so that they will not conflict with the existing names.
Thomas