To learn more: https://www.automationdirect.com/ls-electric-plc?utm_source=BAPkl9v-8EY&utm_medium=VideoTeamDescription
(VID-XG-0092)
LS XGB Help File Video: LP201-2
XG5000 V4.77 2024-06-28
To view the LS XGB Help File please visit: https://cdn.automationdirect.com/static/helpfiles/ls_plc/Content/Home.htm
**Please check our website for our most up-to-date product pricing and availability.
Related AutomationDirect.com Part Numbers: N/A
The XGB PLC offers many ways to communicate over EtherNet. The on-board EtherNet port is referred to as the “Internal FENet,” and allows Modbus/TCP and XGT protocols. For Modbus/TCP, the PLC allows configuration as both a Modbus Slave and Master. In LS documentation Modbus Slave is also called Modbus Server, and Modbus Master is also called Modbus Client. The Modbus Server and Client functions for the XGB PLC can share up to 16 concurrent connections. Let’s set up the XGB PLC as a Modbus client. The first step is to set the TCP/IP settings. To do this we will go to the “Project Window” on the left side of the screen and double-click on “Internal FEnet.” This will open the “Standard Settings – FEnet” pop-up window. Here we can set our IP address, Subnet Mask, Gateway, and DNS Server if needed. We can also use DHCP to allow a local DHCP server to automatically configure the IP settings for the PLC. Using DHCP can lead to potential network routing or unintentional IP address issues so be careful when enabling this setting. Once we configure these settings, we are ready for the Modbus/TCP configuration. If we are using the PLC as a Modbus client, we need to verify the “Number of Dedicated Connections” field has been set to something less than 16 to allow our client to occupy one of the Modbus connections. Ours is set to the default of 3, and we won’t be setting up more than 13 client connections so that number is fine. Now we need to set up a peer-to-peer connection for the “Internal FEnet” network. To do this we will go to the “Project” window on the left side of the screen. Under the “Network Configuration” heading we can right-click on our “Internal FEnet” network and go to “Add Item>P2P Communication.” This opens the “Select P2P” pop-up window, and there will be a drop down with a peer-to-peer connection available for selection. Since we only have one available port it only shows connection 2 as available. Once we select our connection and click “OK,” we see a new peer-to-peer connection added under the “Internal FEnet” network subheading. We can now set up our Modbus client connections. We double-click on P2P Channel and the “Channel Setting” pop-up window opens. We see there are 13 connections available numbered 0-12. If we had put a number other than 3 into the “Number of Dedicated Connections” we would see the number available here adjusted accordingly. Let’s set connection 0 up as a Modbus Client. Under the “P2P Driver” column we can select “Modbus TCP client” from the drop-down list. Don’t worry about the Operation Mode column. This will list server settings. As we are using this channel as a client, it will ignore that column. Once we have set channel 0 as “Modbus TCP Client,” it will auto-populate the TCP/UDP, Client/Server, and Port Number fields. We can then set the IP address of the Modbus server we wish to communicate with. In our example we are going to control a GS20 variable frequency drive located at 192.168.27.105. We can then select “OK” to confirm our settings. Now we need to create a “Peer-to-Peer” entry. We go under the “P2P 02(Internal)” sub-heading and double click on P2P Block. This will open the “LSPLC – P2P 02” tab in the main programming window. We can select channel 0 from the drop-down menu and it will automatically set the driver to the “Modbus TCP client” we configured in the “P2P Channel” window. We leave “Header” blank, and then select whether this will be a Modbus Read or a Modbus Write. Let’s start with a Read function to read the current drive speed. For the “Conditional Flag” column, we can select any Boolean direct or flag variable. We will use the system flag _T200MS.” This will cause the PLC to send every 200ms. If we wanted to use a program determined message send rate, we could use a %MX memory location and then control that address with our logic. For the “Command Type” column we can select single, to read or write a single bit or register, or continuous to read or write a range of consecutive bits or registers. We will select single for our read. The data type can be bit or word. If we wanted to do a coil or input function code, we would select “bit.” For any of the register function codes we would select “Word.” In our example we wish to read the drives speed, which is a word register. “Data Size” corresponds to the number of bits or words we want to read or write. Since we are using a “Single” Command type, this is hard coded to 1. If we were using the “Continuous” command type we would put the number of data blocks we wanted to read or write. “Destination Station” is LS nomenclature for node address. This is the unique identifier for a specific serial node on a Modbus network. For Modbus/TCP servers with a unique IP address, this can be any number. The GS20’s communication card, however, is a Modbus Gateway, that has a node address for its drive data at node 1 and a node address for the drive’s internal PLC at node 2. We will have to set the “Destination Station” to 1 since we want to read from and write to the drive data. The last field is the Variable Setting Content. We configure this by clicking the “Setting” button. This opens the “Variable Setting” pop-up window. Because we aren’t doing communications from one LS PLC to another over the XGT protocol, we don’t use the “Counterpart CPU” area. The “Read area” is the memory location in hex that we will read the data from in the server, and the “Save area” is the direct variable address to which the XGB PLC will store the information. The “Address” area is automatically assigned by the PLC, so we will leave it alone. For our example, we want to read the commanded speed from the drive. If we look in the drive manual, we see that this resides at hex address 0x2102. In XG5000 we use a 3 or a 4 precursor to select the Modbus function code. In our case we want to read a holding register, not an input register, so we will use 0x42102. We would use a 0 or 1 precursor for a bit. We will write this to the internal memory address %MW100. That address was arbitrarily selected and can be any available direct variable address. Because the %M range of memory addresses is reserved for functions just like this, we strongly recommend using that range to avoid unintentionally overwriting PLC or communication data. We have now set up our Modbus read message. We will do the same for the “write” message to control the drive preset speed. We use Index 1, set it to channel 0, make it a P2P “Write” function with an update rate of 200ms, a command type of “Single,” Data Type of Word. For our “Variable Content Settings” we look in the drive manual and see that the address for controlling the drive frequency is 0x2001 so we will use 0x42001 and we will write the data from %MW101. We will write this project to our PLC, reset the PLC to ensure all the network changes were made effective, and then go online with our PLC in monitor mode. If we add our read and write variable words to our “Monitor 2” tab, we see that they are both currently 0. If we change %MW101, which is our speed command write, to 1000, we see that the value changes in the drive and is read back to %MW100. We are now able to control our drive speed from our XGB PLC using Modbus/TCP!
Voted #1 mid-sized employer in Atlanta
Check out our
job openings