This article discusses the Arduino PLC IDE in Instruction List (IL) format, an industrial programming language that is simple and intuitive for those familiar with mnemonic program code. The Opta PLC can be programmed using any of the five official languages specified in the IEC standard and sketches written in C++. This article will focus on programming the Opta PLC using an “Instruction List” to create control programs that resemble simple mnemonic programming. This technique effectively and efficiently implements logical operations in industrial automation and control applications.
Our Program will turn on the CPU LED when it is running. If input one or the CPU user button is pressed, output one, and the first LED output will turn on. Following the steps outlined in this article, you will quickly learn how to build the PLC instruction list code. Let’s get started building the PLC instruction list code.
The entire Arduino Opta IoT PLC Series is located here.
Previously in this series, we have discussed the following:
Opta Introduction Video
Arduino Opta IoT PLC Cutting Edge Hardware – Video
Arduino Opta Software Installation – Video
Arduino Opta IoT PLC Quick Start Ladder Logic – Video
Easy Steps to Establish Communication between Arduino Opta IoT PLC – Video
Arduino PLC IDE Workspace: Unleash the Power! – Video
Programming with the Arduino OPTA PLC – Ethernet Port – Video
Arduino OPTA PLC – Ladder Diagram First Program – Video
Note: A post is usually associated with each video. This will provide additional details and links discussed.
Start a new project.
Open your computer’s Arduino PLC Integrated Development Environment (IDE) software.
Start a new project by selecting “New Project” on the main software screen. A second method of starting a new project is to select “New Project” from the main menu | File. The third method is to choose the icon for a new project.
The new project window will now be displayed. Enter the name of the project in the dialog box. This will be the name of the Program stored on your drive. We will leave the default directory as it is. Ensure that the Opta 1.0 PLC is selected for the target. Select OK. This will now create and save your program file for the Opta PLC.
Mapping physical I/O in the Opta PLC
The Opta has physical inputs and outputs we must map before using them in our project.
In the workspace window, select the Resources tab at the bottom.
Under local IO mapping, you will see all of the physical inputs and outputs on this controller. Select programmable inputs. The programmable inputs mapping will be displayed.
We can assign a variable to each input we intend to use in our instruction list. Under IO type, we can select digital (default) or analog. The analog resolution can also be chosen for the inputs.
Select relay outputs that display the relay outputs mapping. We can once again assign a variable to the relays that we will use in our instruction list program.
Select LED Outputs, which display the LED outputs mapping. These are the status lights on the Opta CPU unit. We will make these represent the relays in our Program. Assign a variable name to the LED output that we will use. The Opta PLC also has a front LED that can be different colors. We will assign the green output to indicate that the Opta PLC code is scanning.
Select the button inputs to display the relay outputs mapping. We can assign a variable name to the user button input. Now that all of our mapping is complete, we can save the Program using the icon on the main page. We can also save the Program using the main menu | File | Save Program.
Tasks in the Opta PLC
To access the tasks in your project, navigate to the project tab and locate the tasks folder.
You will see the list of IOs we have just mapped for this project.
Expand the folder by clicking on the plus sign next to it.
The tasks are categorized into Fast, Slow, Background, and Init. To configure the tasks, right-click on any of the four task folders and select task configuration.
Your programs will be executed within the designated task folders. The Fast Task folder will run your programs cyclically every ten milliseconds. (100 times per second) This can be changed by changing the set period to yes. You can then enter a value in the period column in milliseconds. The majority of programs will be placed in this folder. The Slow and Background task folders will also scan cyclically. They are both set at a fixed period of 100 and 500 milliseconds. (10 times per second and two times per second) These tasks are ideal for functions like math equations, etc. The Init or Initialize task folder sets variables or conditions in the plc after it powers up. It will run for a single scan. Select OK to close the task configuration window.
Starting a New Instruction List Program
Select | Project | New Object | New Program from the main menu to start a new program.
You can also do this by right-clicking on the project name and selecting the new Program under the add heading.
The new program window will be displayed. In our example, we will use an instruction list (IL). Select IL. Name the new Instruction List program and assign it to the fast task folder. The program name cannot have spaces. Select OK.
Our new instruction list program will now be displayed in the work area. This Program also appears under the fast task folder and the project as an instruction list symbol.
In the help menu, you will find all of the operators and their parameters that can be used for this instruction list programming. Save the Opta PLC program.
Programming our Instruction List (IL)
Right-click under the local variables window of the workspace.
We will assign a local BOOL variable. (Can only be used within this Program.) This will be named Always_ON with an initial value of 1. (ON)
When working with instruction lists, we always work with the accumulator. We can enter our Program using the IL reference for this programming language.
This will load the accumulator with a value of 1.
This will store the LED_Run outputs with the value of 1, turning it on. This is our indication that the Program is working.
This will load the accumulator with the value of the button. If it is on, then a one or off is a zero.
The accumulator is logically “OR” with input 1, and the result is stored back into the accumulator.
Based on the accumulator value, the ST instruction will copy this value to Output 1 and LED Out 1.
Save the Program by using the icon on the main menu or selecting “Save project” from the main menu | File.
Download the Instruction List Program to the Opta PLC
Select setup communication from the main menu | On-Line.
In the device link manager window, select Modbus TCP and then select activate.
We can now enter the IP address we established in the following post. Programming the Arduino OPTA PLC – Ethernet Port
Our communication method with the OPTA PLC is now set.
Select the connect button. We will now see that our computer is connected to the Opta PLC controller.
Select the download icon on the main menu.
Since we didn’t compile the project first, the PLC IDE prompts us before downloading.
The output window will display the status of the download operation. When this has finished, the bottom right side of the software will show you that the PLC IDE and controller programs are the same.
Monitoring the Instruction List Logic and Variables
Select the watch icon on the main menu.
This will display the watch window. We can enter and select the variables (tags) we want to monitor.
Watch the video below to see how to create Instruction List (IL) programs with the Arduino Opta IoT PLC.
Watch on YouTube: Arduino OPTA PLC – Instruction List (IL) First Program
If you have any questions or need further information, please contact me.
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to learn 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.