- To learn more: https://www.automationdirect.com/ls-electric-plc?utm_source=833QFnCHxkY&utm_medium=VideoTeamDescription
(VID-XG-0064)
LS XGB Help File Video: LP003
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
There are two types of user-created memory locations: global variables, and local variables. Global variables are available to any program in the PLC. Local variables are only available to the program the local variable is attached to. To view the global variables for this PLC, we are going to look at the “Global/Direct Variables” screen. To get there, we will go to the project browser on the left side of the screen and double-click on “Global/Direct Variables.” A new window opens with the “Global/Direct Variables” screen and several tabs. The “Global Variable” tab will show all global variables created. Any custom created global variables as well as auto-generated global variables associated with analog, specialty, or comms modules will appear here. Local variables are used in a specific program. To help visualize this, I have created a program called “LadderProgram1” and created a simple rung of logic in this program. This rung uses the global variables “Test 1,” and “Test 2,” and the local variable “Test 4.” If we go to the project browser and twirl down the “LadderProgram1” heading, we will see the program itself as well as the “Local Variables” screen. If we double-click “Local Variables,” it will pull up the “Local Variables” screen for this program. This screen lists both global and local variables used by the program. You can see that “Test1” and “Test2” are present, as well as “Test4.” If I go to the “Global/Direct Variables” screen you can see “Test1” and “Test2” are present here as well, but “Test4” is not. It is a local variable only and can only be used by its local program. It is important to be careful when naming local variables, as two different programs can have the exact same variable name for two different local variables. I could create a second program and create a second local variable in that program also called “Test4.” The PLC will know the difference, but it is very easy for a programmer to get confused if using this type of naming. It is recommended to name your local variables unique names even though they are only accessible by their local program. If we look at a global variable in the local variables screen, we can see that the type is no longer “VAR_GLOBAL” but has instead changed to “VAR_EXTERNAL.” This is important because it allows the global variable to be used in this scan program.
Voted #1 mid-sized employer in Atlanta
Check out our
job openings