05-07-2020 01:38 PM
I have (2) drives each with a unique IP address on the same network, D1 = 192.168.1.20 ... D2 = 192.168.1.30
I have attached my initial code, it works for the drives individually but I cannot enable or communicate with both drives at the same time.
I have no experience with Ethernet communication at all, is there an example out there to help me get started? The manufacturer has there own canned application for drive control, I can run both drives simultaneously with it, so it must be possible.
Any help is greatly appreciated.
05-07-2020 01:54 PM
You probably need to set them up with different ports on the PC side.
What if you split them into separate loops?
05-07-2020 02:33 PM
I pulled the commands into a stacked sequence structure and it seemed to not hate that. Seems to be intermittent though between working and not working (error 60).
05-07-2020 04:34 PM
Did you read the error message for error 60? "Specified port is already in use". So it seems to correlate with my theory you need different ports.
Stacked sequence structures are never the answer. A flat sequence structure can help from time to time. But you didn't indicate whether you tried to use different port numbers.
05-08-2020 07:02 AM - edited 05-08-2020 07:05 AM
So far I'm using the same port, I think how this works is that you use the same port but you get a unique "connection ID" from the Open TCP vi, when executing a write of read command the ID is needed to keep traffic moving to the correct device.
I think. I had both devices initialized yesterday at the same time, unfortunately i ran out of time and didn't get to flex the code and actually issue motion commands to both devices.
Totally agree about the sequence structure, i will replace it with a state machine. I used it because it's much quicker to test a sequence of events rather than creating a state machine...anyway. I'll be cleaning up the code this weekend and testing next week so i should have an update early next week.
05-08-2020 10:32 PM
I recently had a Project that connected to 24 serial devices running through a "concentrator" (I'm not sure of the proper name of this gadget, but it took 12 serial ports and converted them to an IP address with 12 "port" connections, e.g. 192.168.1.100:8001) and 24 video cameras each with its own IP. In MAX, I could see all of the Cameras and all of the serial devices (they looked like VISA devices, and were opened with a VISA Open, while the cameras were opened with IMAQdx). Provided we used smallish images (I don't remember the size, possibly 600 x 400) and low frame rates (10 fps), we could acquire images from all the cameras and all of the serial devices (readings coming in at 10/sec, each reading being a string of maybe 2 dozen characters).
Note, however, that we are not making a direct TCP/IP connection to these devices -- we are connecting to them as "something else", i.e. a Serial Device or a Camera, with the LabVIEW VISA or IMAQdx driver handling the TCP/IP details. If you only want to connect to, say, 2 devices, it seems to me that you could easily establish two Network Streams (or other TCP/IP communication 1-1 connection) if you had two Ethernet ports on your PC (hmm -- do I know how to get LabVIEW to specify which port it uses for communication? Oh, sure, I recall doing that when running LabVIEW RT, with the Host connecting to a remote IP Target using the "other" (dedicated) Ethernet port ...).
Bob Schor
05-14-2020 07:30 PM
I did some more work with this today and found that i can communicate with both devices individually, however the connection is lost as soon as a parallel command is executed, labview also locks up and i have to stop the VI.
I ran the ethernet cables through a switch to help direct traffic. No dice!
The literature on the drives claims that the port address doesn't matter, but i use different TCP port addresses just in case. The sequence of events in the attached code is to enable the drives at each IP address in series, and then move onto motion command events. The idea is to generate a "connection ID" that is unique to each device and maintain that ID through the program via shift registers to issue commands. It works great for individual commands.
If anyone has any tips or can explain how to properly setup an ethernet device network, please let me know.
05-15-2020 03:21 AM - edited 05-15-2020 03:22 AM
As multiple people have said I think you need to set the local port to unique values. If i'm honest I never usually wire anything to this terminal because the default value of '0' will assign any unused port...is there a reason that you have to specify port 61556
05-15-2020 04:10 AM
The vendor code used this port number and it works for a single drive. I'm using 61557 and 61556 as the local ports. I have done as you mentioned and left these inputs blank (0) as well, but there is no change in the performance when running multiple devices.
05-15-2020 10:28 AM
I'm not in the office today to test the code but thought I'd share my approach to see if anyone has a recommendation.
1. I have unwired the TCP port to allow it to select whatever port is available.
2. I have Created a new VI that simply runs (2) parallel loops, (1) loop for each device
3. I have also created a version using UDP, since TCP keeps dropping the connection i think it's worth a try
Once i'm back in the office i can test these methods, if you have any suggestions or recommendations please let me know.
Thanks