This tutorial describes the guidelines and procedures for using five additional analog inputs on your PLC by inserting the LibIntegratedIoExt library and using the AnalogInputProbe function block in StartPrg.
Components
Software: MasterTool IEC XE 3.34;
PLC: XP340 and XP325 (used in this tutorial, but all models with analog input support this function);
Firmware version: 1.11.14.0 (the analog input expansion functionality can only be used from this firmware version onward).
Tutorial Sections
1. ARCHITECTURE
2. DEVELOPMENT
2.1. Inserting the LibIntegratedIoExt Library in MasterTool IEC XE
2.2. Declaring the AnalogInputProbe Function Block in StartPrg
2.3. Physical Connections of the Analog Inputs
2.4. Demonstration of the FB Operation with Additional Analog Input
3. VIDEO
1. ARCHITECTURE
In the architecture of this tutorial, both PLCs were powered by a 24VDC source, the analog output AO0 of the XP340 was connected to its analog input AI1.I, the analog output AO2 was connected to the analog inputs AI0.V and AI2.V. The analog inputs AI0.V, AI3.V, and AI4.V were connected to the AO3 input of the XP340. The analog input AI0.I of the XP340 was connected to the analog output AO0 of the XP325, the analog input AI2.I was connected to the analog output AO1 of the XP325, the analog input AI3.I was connected to the analog output AO2 of the XP325, and the analog input AI4.I was connected to the AO3 output of the XP325.
In this test, the analog inputs of the XP325 were not used; all those identified above belong to the XP340.
The XP340, XP325, and the computer's Ethernet port were connected to the Ethernet ports of a switch via the NX9202 cable.
2. DEVELOPMENT
This tutorial will show the steps to insert the LibIntegratedIoExt library in MasterTool IEC XE, in addition to configuring the AnalogInputProbe function block, which allows you to use five additional analog inputs, in voltage or current mode, addressing it as the respective number of the PLC's physical analog inputs (0, 1, 2, 3, 4). This allows the user to access the analog input through the block, even if the input is not configured in MasterTool or is configured in current/voltage mode. It is possible to use AI0.V and AI0.I simultaneously, for example.
It is important to have the Nexto Xpress Series Manual on hand, allowing you to consult it during the application steps. This document will guide you on technical characteristics, installation, programming, and configurations.
2.1. Inserting the LibIntegratedIoExt Library in MasterTool IEC XE
Important: Both the library and the sample project are available for download in the .zip file at the end of this tutorial.
With the project open in MasterTool, click on the top tab "Tools".
Access the library repository.
Click on "Install" and select the compiled library file.
Now access the Library Manager in the device tree.
In the library manager, select the "add library" option, go to application and common, and add the "LibIntegratedIoExt" library.
Click OK.
2.2. Declaring the AnalogInputProbe Function Block in StartPrg
This part of the tutorial is extremely important. The block can only be declared in StartPrg, because it needs to be called only once during the application's execution. If the block is declared in UserPrg or in a user-defined POU, its operation is not guaranteed.
You also need to declare a block for each analog input you want to use.
Access StartPg in the device tree and insert an EN/ENO box. You must instantiate the block with the name "LibIntegratedIoExt.AnalognputProbe".
Then we must declare the block variables.
INPUT_NUMBER: Number of the desired analog input. Type: USINT;
INPUT_MODE: Operating mode of the analog input (available as the following values: voltage, AI_VOLTAGE_0_10, AI_CURRENT_4_20, AI_CURRENT_0_20, or disabled, AI_NOT_CONFIGURED). Type: ANALOG_INPUT_MODE;
INPUT_FILTER: Type of filter for the analog input (100_ms, 1_s, 10_s). Type: ANALOG_INPUT_FILTER;
PROBE_VARIABLE: Address of the integer variable where the value of the respective analog input will be loaded. Type: POINTER_TO_INT;
AnalogInputProbe: Displays the block's error code. Type: PROBE_ERROR_CODE.
To use the PROBE_VARIABLE parameter, you must declare a new integer variable and use the address operator "ADR" to assign the variable's value to the pointer. That is, this new variable assumes the value of the analog input.
As shown in the tutorial example, the blocks were configured as follows.
2.3. Physical Connections of the Analog Input
As this tutorial is only intended to demonstrate this new functionality, the signal was generated on the analog input by connecting it to an analog output and forcing values in MasterTool.
You should follow the connection available in the Xpress technical characteristics document, as shown in the figure below.
We derived the negative signal from the Xpress power supply to terminal C3 of the analog outputs AO0 and AO2, AO3 of the XP340 and AO0, AO1, AO2, and AO3 of the XP325. Also to the C2 terminals of the analog inputs of the XP340.
The analog input AI0.V was connected directly to the analog output AO2 of the XP340. The analog input AI0.I was connected to the AO3 output of the XP325.
The analog input AI1.V was connected directly to the analog output AO3 of the XP340. The analog input AI1.I was connected to the AO0 output of the XP340.
The analog input AI2.V was connected directly to the analog output AO2 of the XP340. The analog input AI2.I was connected to the AO0 output of the XP325.
The analog input AI3.V was connected directly to the analog output AO3 of the XP340. The analog input AI3.I was connected to the AO1 output of the XP325.
The analog input AI4.V was connected directly to the analog output AO3 of the XP340. The analog input AI4.I was connected to the AO2 output of the XP325.
The configuration of the analog I/Os in MasterTool is performed by accessing Integrated I/O in the device tree.
The I/Os were configured as shown in the figure below.
XP340:
XP340:
XP325:
2.4 Demonstration of the FB Operation with Additional Analog Input
First, we must configure the voltage/current modes in the block and the voltage/current mode in Integrated I/O in MasterTool IEC XE. In this example, the analog inputs were configured in MasterTool as 0 - 10 VDC voltage and in the AnalogInputProbe block as 4 - 20mA current.
Then you must log in to the PLCs using the NX9202 Ethernet cable.
With the physical connections made and being online with the PLC, values were forced on the analog output AO1 of the XP340 and on the AO0, AO1, AO2, and AO3 outputs of the XP325, which were configured as 4 - 20mA, and on the analog outputs AO2 and AO3 of the XP340, which was configured as 0 - 10VDC.
On the analog input rVar, you can read the value 4442, which means it is receiving the signal from the analog output AO3 of the XP325.
On the analog input rVar1, you can read the value 5470, which means it is receiving the value from the analog output AO0 of the XP340.
On the analog input rVar2, you can read the value 1473, which means it is receiving the value from the analog output AO0 of the XP325.
On the analog input rVar3, you can read the value 2493, which means it is receiving the value from the analog output AO1 of the XP325.
On the analog input rVar4, you can read the value 3440, which means it is receiving the value from the analog output AO2 of the XP325.
On the analog output AO2 of the XP340, configured as 0 - 10 VDC, I forced the value 1200, and this value is read, approximately, on the AI0 and AI2 inputs in Integrated I/O.
On the analog output AO3 of the XP340, configured as 0 - 10 VDC, I forced the value 3000, and this value is read, approximately, on the AI3 and AI4 inputs in Integrated I/O.
CURRENT
VOLTAGE
3. VIDEO
Comments
0 comments
Please sign in to leave a comment.