The IEC 61131-3 is an international standard for Programmable Logic Controllers (PLCs). The standard defines basic software architectures and programming languages of the control program within PLCs. The standard defines two graphical and two textual programming languages:
IEC 61131-3 is vendor independent and very well established in Europe, but gaining popularity in North America and Asia as the programming standard for industrial and process control. The use of standard programming languages has a positive impact on the software life-cycle that includes requirements analysis, design, construction, validation, installation, operation, and maintenance. The integration of IEC 61131-3 programming languages with customizable and flexible NI hardware allows the incorporation of specialized I/O such as motion or machine vision capabilities while preserving previous investments through reuse of existing code. This integration is facilitated by using the CODESYS IDE for the development and deployment of IEC 61131-3 languages to NI Linux Real-Time devices such as CompactRIO and Single-Board RIO.
CODESYS is a highly adopted development environment for programming controlling applications using the IEC 61131-3 standard. CODESYS supports all 5 programming languages part of the standard as well as included compilers to transform the application code into machine code which is then downloaded into the controller. This platform-independent development environment is compatible with the PLCs and automation components of over 250 companies including National Instruments.For embedded developers creating smart machines or industrial equipment, CODESYS provides a common system that uses common software. This allows the integration of NI embedded devices in charge of specialized tasks with existing controllers or automation components. The common development environment let’s system designers work with any of these components and facilitates code reuse and debugging tasks.
Figure 1: The CODESYS IDE provides a common system and software for a variety of industrial automation devices
CODESYS is used in a variety of automation applications from traditional process automation to factory, mobile and energy automation. To learn more about CODESYS please visit the link below.>>Learn more about the CODESYS IDE
The LabVIEW FPGA IEC 61131-3 Interface Utility allows industrial automation code defined by the IEC 61131-3 standard to interface with the FPGA fabric on NI Linux Real-Time devices through the 3S CODESYS IDE. This utility allows you to access the I/O from a compiled LabVIEW FPGA bitfile through several industry-standard languages such as Ladder Logic, Structured Text, and Function Block Diagram. Additionally, you can deploy and compile IEC 61131-3 code and FPGA bitfiles directly through the CODESYS IDE.
Figure 2: The LabVIEW FPGA IEC 61131-3 Interface Utility allows IEC 61131-3 code to interface with FPGAs on NI embedded devices
The following diagram demonstrates the flow of data between software and hardware components for deploying a CODESYS application to an NI Linux Real-Time target.
Figure 3: Data flow for the LabVIEW FPGA IEC 61131-3 Interface Utility
The following list describes the components in the diagram: Host Computer—The computer that runs necessary software components.
LabVIEW IDE—The IDE you use to develop and manage VIs.
FPGA VI and Compilation Tools—The FPGA VI is the VI that defines the I/O of the NI Linux Real-Time target. The LabVIEW compilation tools translate the FPGA VI into binary data that you can download and run on the NI Linux Real-Time target. bitfile—A compiled version of the FPGA VI. Device Description Generator— Tools that generate a custom device description for the CODESYS IDE to access the I/O of the NI Linux Real-Time target.
XML Device Description—An XML file that contains information about the controls and indicators in the FGPA VI. CODESYS IDE—The IDE you use to build and deploy CODESYS applications.
NI Linux Real-Time Target—NI Linux Real-Time hardware that runs the code you create with LabVIEW and CODESYS.
LabVIEW Real-Time VI—The VI that runs on the NI Linux Real-Time target and communicates programmatically with the FPGA VI. LabVIEW Runtime—The LabVIEW Run-Time Engine that includes the libraries and other files necessary to run basic application types built in LabVIEW. CODESYS Application—The executable control program you deploy to the NI Linux Real-Time target using CODESYS. CODESYS Runtime—The CODESYS runtime system that offers functions for the NI Linux Real-Time target to communicate with the CODESYS programming system. bitfile—A compiled version of the FPGA VI that you download to the NI Linux Real-Time target. FPGA—Reprogrammable chips.
The rest of this document goes through the basic steps of creating a deploying an application with the LabVIEW FPGA IEC 61131-3 Interface Utility.
The first step to interface with the FPGA on NI Linux Real-Time devices is to create an FPGA application. This can be done using LabVIEW and the LabVIEW FPGA Module. To learn more about creating LabVIEW FPGA applications please visit the link below.
>>Creating LabVIEW FPGA Applications. Once the application is complete it must be compiled to get the Bitfile required to import the FPGA configuration into the CODESYS IDE. To learn more about LabVIEW FPGA compilation options please read the resource below.
>>LabVIEW FPGA Compilation Options.
Once the Bitfile is created it can be transferred to the CODESYS IDE.
Use the XML Device Description tool included with the LabVIEW FPGA IEC 61131-3 Interface Utility to generate and XML file suitable for CODESYS to interpret the FPGA application as a new device.
Figure 4: Generate XML Device Description
1. In LabVIEW, select Tools»IEC 61131-1 Interface Utility»Generate XML Device Description to launch the Generate XML Device Description dialog box.2. In Source LabVIEW FPGA bitfile, specify the path to your FPGA bitfile. You can also use the LabVIEW FPGA IEC 61131-3 Interface sample project to generate an FPGA bitfile. Access this sample project by selecting File»Create Project in LabVIEW and selecting LabVIEW FPGA IEC 61131-3 Interface in the IEC 61131-3 Interface category. Refer to the sample project documentation in the Project Documentation folder of the project for more information about this sample project.3. In Destination directory, specify a directory to save the XML device description file. Click Generate.4. Click Exit to close the Generate XML Device Description dialog box.
After installing and configuring the software and hardware, you build a CODESYS application and deploy it to the NI Linux Real-Time target. After deploying, you can use the IEC 61131-3 programming languages to program the NI Linux Real-Time target. Note Before proceeding, complete sections 4 and 5 of this document using the LabVIEW FPGA IEC 61131-3 Interface sample project described in step 2 of section 5. The following steps utilize the attached CODESYS example project and assumes that the FPGA VI included in the sample project was not modified from its original state.
When deploying your application, this is done the same way as with any other device in CODESYS. The IEC 61131-3 along with the FPGA bitfile will be automatically deployed to the right locations in the NI Linux Real-Time target. Note Deployment requires a IEC 61131-3 Deployment License for NI Linux Real-Time .
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.