In the world of programmable logic controllers (PLCs), variables are a crucial component of any program. They allow for the storage and manipulation of data and are essential for creating complex programs that can perform a wide variety of tasks. In this article, we will take a closer look at variables in the LS Electric XGB PLC memory and discuss their scope or the area of the program in which they can be accessed.
What are Variables?
Before diving into the specifics of the LS Electric XGB PLC variables, let’s briefly discuss what variables are. Variables are essentially placeholders for data that is used within a program. They can store various data types, including integers, floating point numbers, strings, etc. Variables can be manipulated using various programming constructs, such as mathematical operations, string concatenation, and comparisons. Typically, variables are declared before you start to program the PLC, but they can be declared anytime. 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 PLC – Video
See the list of references for the XGB PLC, including the frequently asked questions (FAQ) at the end of this post.
XGB Memory
The LS Electric XGB PLC’s memory is backed up by non-volatile RAM. Variables like the RTC (Real Time Clock), can maintain its settings for 6 months without a battery.
PLC Memory Mapping
The PLC Memory can be defined in 3 major sections:
Memory Area for User Programming.
The programmer controls this area for any use in the application programming.
Memory Area for PLC I/O.
This area is designated for the Physical I/O of the PLC.
Memory Area for PLC Flag Registers.
This area is updated by the PLC to show the system status. You can reference these registers in the programming.
The total XGB memory can be summarized in the following table.
This can be shown in the following block diagram of the XGB.
The PLC has 384 KB for your program and parameter area.
XGB Memory Retentive Areas
The following table shows the XGB PLC’s memory-retentive areas. Memory retention is used when you want to start and stop the PLC without losing a bit or word status.
(1) Initialization of data according to restart mode
There are three variables related to restart mode (Default, initialization, and retain variable). The initialization method for
each variable in case of executing restart mode is as follows.
(2) Operation of data retain area
The method of deleting the Retain data is as follows.
– RESET through XG5000 (Overall Reset)
-Execute “Clear PLC” through XG5000 at STOP mode
– Writing by program (Initialization program recommended)
– Writing ‘0’ FILL, etc, at XG5000 monitor mode
Refer to the following table for holding retained area data or reset (clear) operation according to PLC operation.
(3) Initialization of data
If PLC becomes ‘Clear Memory’ status, the memory of all devices is deleted as ‘0’. When you want to specify the initial value,
use the initialization task. At the CPU module, there are two types of built-in memory. One is program memory to save programs
made by the user for a user to structure the system. Another is the data memory device area saving data during operation.
Indirect Addressing (Pointers) XGB
Arrays can be used in the XGB PLC for indirect addressing or pointers. We will discuss this in future posts.
Variable Scope in the LS Electric XGB PLC
In the LS Electric XGB PLC, variables are used extensively throughout programs. They can be declared using various data types, including integers, floating point numbers, and strings. One important concept to understand when working with LS Electric XGB PLC variables is scope. Scope refers to the area of the program in which a variable can be accessed. Variables can be either local or global in scope.
System Variables
The scope of variables is easier to see in the project navigation window. System variables can be used by any item in this window.
Global / Direct Variable
Global variables can be used by anything under the device, in this case, the “LSPLC.” The variables cannot be seen outside of this area.
Local Variables
Local variables can only be accessed with the specified scope. In this case, the program for the Easy Transfer Line can only access these variables.
Variables are a crucial component of any PLC program, and the LS Electric XGB PLC is no exception. Understanding the basics of variable declaration and scope allows you to create more complex and powerful programs to control various industrial systems. Whether you are a seasoned PLC programmer or just getting started, understanding variables is essential for success.
Watch on YouTube: LS Electric XGB PLC Variables and Scope
LS XGB PLC Additional Information:
LS XGB PLC – Series
– FAQ – Frequently Asked Questions
Product Cut Sheet (XEM-DN32H2 Unit Specifications)
LS PLC Technical Specifications
Manuals:
Interactive Guide
LS PLC User Manual
Other Documents:
PLC Installation Guide
Product Brochure
PLC Statement of Direction
Software and Support:
XG5000 / XG-PM PLC Programming Software
XEM PLC Firmware
Quick Start Procedures
XEM Pulse Servo Wiring Diagrams
Example Applications Directory
If you have any questions or need further information, please get in touch with 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.