In this Tutorial I will show you how to Program with Local Variables in PLCNEXT.It is very basic and would be a big step if it is your first time with PLCNEXT.
Reference Link
Add a Program
Click the PLC Object in the Plant View.
The current Version can be checked in here.
Let’s create a new program.
Select the “Programs” Item in the Components on the right hand side.
Right Click>Add Program.
NewProgram is inserted.
Double Click the “NewProgram” Item.
The implementing programming language can be chosen here.
Let’s click the “Add ST Code Worksheet” to create ST Program Block.
Program Block is added.
Define the Local Variable
Let’s define the Local variable here.
Open the variables Tab, the Variables screen is shown.
We can just enter the variable name directly to create it.
In this example, 3 local variables are created.
Open the Code Tab and here is the work-space to make your program.
Let’s create a “AND” Logic.
Assign the Task
Although the program is created, we need to assign a Task to call this program.
Click the PLCnext object in the PLANT view.
We will explain what an ESM object later.
First, press the “Enter task name here “ to create a new task by entering the task name.
Task is created.
Drap the NewProgram that was created in the previous step under the task.
Now that NewProgram will be called in the execution cycle.
ESM?
ESM is Execution and Synchronization Manager, a concept that, like Codesys or Beckhoff, can split couple programs into different tasks.
Processor Core is managed by ESM , if there are more than 1 core in your controller, ESM1,ESM2..ESMn is shown in PLCNext Engineering.
For Example,AXF2152 had 2 cores, So you can see ESM1 and ESM2 in the PLCNEXT Engineering.
https://www.plcnext.help/te/PLCnext_Runtime/ESM.htm
Download
Select the PLC object under the Project item in the Plant view,right click>Write and Start Project.
Enter the username and password.
Login Name:admin
password is printed on the PLCNEXT.
Monitor
OK,After the project is downloaded to the PLC, we can monitor it and view the current status.Double click the myTask1>NewProgram1.
The current value of each variable is displayed.
A TRUE/FALSE box is shown while the variable is clicked.
We can change the current value of this variable.
Let’s change it to TRUE.
Because it is a AND Logic, bDevices will not be True.
The bDevices3 is changed to TRUE while bDevices3 is in True too.
We can also open the Variables tab to see all the variables status.