XGB PLC Ladder Logic First Program

The IEC (International Electrotechnical Commission) XGB PLC, developed by LS Electric, offers a convenient programming interface using the XG5000 software in ladder diagram format. This widely used industrial PLC language is known for its simplicity and intuitiveness. The PLC can be programmed in four of the five official languages specified in the IEC standards.
XGB PLC Ladder Logic First Program
Previously, a setup involving green and red-lighted pushbutton switches was integrated (wired and tested) with our LS Electric XGB PLC (XEM-DN32H2 Unit). We will continue creating, downloading, and testing a start-stop circuit using ladder logic in our controller. Monitoring the ladder logic program with the XG5000 software provides a user-friendly experience and familiar tools. Let’s get started.

Previously in this LS Electric XGB series, we have done the following:
Transform Automation with LS XGB PLC: The Solution
Unboxing and Powering Video
Install & Com w/ XG5000 PLCVideo
LS Electric XGB PLC Variables and ScopeVideo
Wiring Discrete I/O to an XGB PLCVideo
See the list of references for the XGB PLC, including the frequently asked questions (FAQ) at the end of this post.

XGB PLCs are programmable logic controllers widely used in industrial automation to control machinery and automate processes in industries such as manufacturing, automotive, and energy. Ladder logic is the most common programming language used to program PLCs. It is named after the graphical representation of the program, which looks like a ladder with two vertical rails and a series of horizontal rungs between them.
XGB PLC Ladder Logic First Program
Each rung represents a specific action or condition; the logic flows from left to right and top to bottom. The conditions of the previous rung are available for the next rung of logic.

Previously, we installed the programming software on our computer and established communication to our XEM-DN32H2 controller using an Ethernet connection.
Wiring Discrete I/O to an XGB PLC
We then wired and tested green and red-lighted pushbutton switches. This ensured the wiring was correct and the PLC read the signals.
Watch the video below to see the documentation, programming, and monitoring of the ladder logic diagram start-stop circuit on the XGB PLC.

Start a New Project

Once the software is installed, begin a new project and define the hardware configuration of your PLC. Start the XG5000 programming software.
Developing LD Programming Code
We can start a new project by selecting the icon on the main menu. This can also be done by selecting the main menu | Project | New Project or by using the shortcut combination of Ctrl + N.
Developing LD Programming Code
The new project window will now be displayed. Enter a name for the new project. You will see the default directory in which our program will be stored. Under the heading PLC, ensure we select the make and model of the LS Electric PLC we will be programming. This is the XGB (IEC) Series, XEM-DxxxH2 Type, and we will leave the LSPLC name as the default.
Under the program heading, we can select the program’s name and the programming language. We will leave this as the default name and ensure the language is set for Ladder Logic Diagram (LD). Select OK.
Developing LD Programming Code
Note: As we program, ensure that you select save often. This can be done with the main page icon or main menu | Project | Save…

Assign Names to Inputs and Outputs

Documentation is a critical component of any programming language.
Inputs and Outputs Documentation
In the XG5000 programming software project window, double-click on the Global/Direct Variables under our LS PLC.
Inputs and Outputs Documentation
We can now enter the variables for the inputs and outputs that we wired previously to our XGB PLC.
Start – %IX0 – Normally Open Input from Green Pushbutton
Stop – %IX1 – Normally Closed Input from Red Pushbutton
Green_LED – %IQ0.0.0 – Green LED on Pushbutton
Red_LED – %IQ0.0.1 – Red LED on Pushbutton

Create the Ladder Logic Diagram Program

Return to our ladder logic diagram programming window. You will notice all the ladder logic diagram icons for us to use in our program.
LD start stop circuit
Select the F3 Normally Open Contact. Click on the workspace where you want this contact to be located. The select variable window will now be displayed. Select the start variable that we just named and select OK.
LD start stop circuit
This contact will now show on our workspace.
Our stop input will now be put next to our start contact. Since the stop pushbutton is wired normally closed, we will use a normally open contact.
LD start stop circuit

Transfer the Program

We will now transfer the ladder logic program to our XGB PLC.
Transfer the PLC LD program
Select Connection Settings from the main menu | Online. The connection settings window will now be displayed.
Transfer the PLC LD program
Since we do not know the IP address of the XGB PLC, select network browsing. On the network browsing window, expand the Ethernet option. This will instruct the software to look out onto the network and report back all of the IP addresses for the PLCs connected. Select the one found and select OK.
Transfer the PLC LD program
Returning to the connection setting window, we can now select connect.
Transfer the PLC LD program
The bottom of the XG5000 software will show red, indicating that the PLC has stopped scanning the program. It could also be green, indicating that the PLC is running and scanning the program.
Select Write… from the main menu | Online. The write-to PLC window will be displayed. We will leave everything as their default and select OK.
Transfer the PLC LD program
Our program will now transfer to the XGB PLC. Messages will indicate if any errors have occurred and when the writing is complete. Select OK.
Transfer the PLC LD program
Since we changed the IP setting to the default DHCP, our IP address for the controller has changed. Connect again to the PLC using the same method we used last time.

Monitor the Program

Once connected to the PLC, change the controller’s mode to RUN. This will execute our ladder logic diagram.
Monitor XGB PLC Ladder Logic First Program
Select the run icon on the main menu. A message will be displayed asking if you want to change to run mode. Select Yes.
Monitor XGB PLC Ladder Logic First Program
Our program is now running. Select the monitor icon on the main menu to start monitoring our ladder logic diagram in the XG5000 programming software.
Monitor XGB PLC Ladder Logic First Program
The true conditions will be displayed as solid blocks, and the label will be red.
Monitor XGB PLC Ladder Logic First Program
Call up Monitor 1 and enter the inputs and outputs.
Operate the pushbuttons to ensure that our start-stop circuit is working as expected. We can monitor the conditions on the ladder diagram and the monitor 1 display. This lets us catch any errors or issues before commissioning the PLC in the field.
Monitor XGB PLC Ladder Logic First Program
Watch the video below to see how to program ladder logic diagram into our XGB PLC.

The XGB PLC ladder logic programming provides a powerful and intuitive way to control industrial processes and machinery. You can create sophisticated programs to automate various applications with the right software and a solid understanding of ladder logic principles. I hope this has been a helpful introduction to creating your first program using the XGB PLC ladder logic diagram.

Download our sample XGB ladder logic program here.

Watch on YouTube: XGB PLC Ladder Logic First Program

LS XGB PLC Additional Information:

If you have any questions or need further information, please contact me.
Thank you,
Garry


If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to know and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimals, Hexadecimal, ASCII, and Floating Points.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available for free download. The link is included when you subscribe to ACC Automation.

Leave a Comment