Using the I/O Extension, Master mode

Top  Previous  Next

This tutorial will guide you through the use of the I/O Extension and will in detail demonstrate and explain the steps required to use the powerful features available.

 

The following steps are required to set up and use the I/O Extension:

 

1.Creating the application and the job.
2.Adding the net to the I/O Extension.
3.Adding MODBUS I/O modules to the net.
4.Configuring the job and effectively binding variables to physical I/O.
5.Testing the application in the RTCU Emulator.
6.Transferring the application to a physical RTCU device.
7.Monitoring the I/O by using the I/O Monitor dialog.

 

 

1. Creating the Application and the Job

To illustrate the I/O Extension, the following small VPL program will be used:

 

INCLUDE rtcu.inc
 
VAR_INPUT
  DI1 : BOOL;
  DI2 : BOOL;
END_VAR;
 
VAR_OUTPUT
  DO1 : BOOL;
  DO2 : BOOL;
END_VAR;
 
PROGRAM main;
BEGIN
  DO1 := DI1;
  DO2 := DI2;
END;
END_PROGRAM;

 

 

The above application is very simple as it has two BOOL variables in the VAR_INPUT section and another two BOOL variables in the VAR_OUTPUT section.

The logic is equally simple as the only operation consists of copying the state of the two input/output pairs to each other.

 

Despite the simplicity of the above application, it will allow us to demonstrate how to set up and configure the I/O variables so that:

 

DI1 will be allocated to external I/O digital input #1.

DO1 will be allocated to the on-board digital output #1.

DI2 will be allocated to external I/O digital input #2.

DO2 will be allocated to the on-board digital output #2.

 

For detailed information on how to create and compile the application and create the job, please refer to the Tutorial section.

 

 

2. Adding the Net to the I/O Extension

After the application and the job have been created, a net must be added to the I/O Extension.

Define a net by right clicking on the item "I/O Extension" and then click  "Add..."

 

modbus_tut_1

 

 

In the "I/O Extension net" it is possible to choose whether the connected RTCU device will act as a master to control the I/O devices or as a slave to allow another device to use its input/outputs. In this tutorial we will configure the device to be a master.

 

Please note that only serial channels with RS-485 capability are supported by the I/O extension. It is not possible to change the net label and the net ID as it is currently limited to defining only one net.

 

IOext-net

 

Please make sure that the "Connection" parameters (Port, Baud, Data bits, etc.) match the parameters of the physical MODBUS network deployed.

 

Click on "OK", then a net is created on the project tree.

 

modbus_tut_3

 

 

 

 

3. Adding MODBUS I/O modules to the Net

After the Net has successfully been added, it is time to add one or many I/O modules to the net.

To demonstrate the concept of adding MODBUS I/O modules to the net, we will limit this step to only one module. Adding several modules is, however, equally simple if the outlined steps are followed.

 

 

The next step is to add the I/O Module to the net already present in the project. Right-click on the net labeled "NET-1" and click on "Add..."

 

modbus_tut_4

 

 

The following dialog shows:

 

modbus_tut_5

 

 

In the above dialog, a descriptive name for the I/O module/device can be given. In addition, the MODBUS address and various other parameters, as described in the Project Control - I/O extension device, can be entered. It is important to get all the parameters for the specific module correct. Therefore it may be necessary to consult the technical documentation for the specific module.

 

In our case we will be adding an I/O module with 4 digital inputs and 5 digital outputs:

 

modbus_tut_5_1

 

 

As it can be seen above, the name of the module is "Dev1" and the MODBUS address is "1".

 

 

When this has been done, a new item should appear in the project as in the following figure:

 

modbus_tut_6

 

 

Please note that the modules delivered by Logic IO are configured to 9600 bps and have the assignment "address 1". If another baud rate or address is set in step 2 above, or more than one module is attached to the net with the same address, please right-click on the device name and then click on "setup module".

 

modbus_dev_setup

 

A setup wizard for the modules delivered by Logic IO as shown below will guide you through this in order to change the configuration of the device:

 

modbus_dev_setup_page1

 

 

4. Configure the Job, effectively binding variables to physical I/O

As there is no difference for I/Os located natively on-board on RTCU devices and I/Os located remotely on a MODBUS module, the job configuration step works virtually the same as described in the Configure Job section.

 

The job configuration:

 

modbus_tut_job_config

 

 

As it can be seen from the above configuration, the configuration as described in step 1 has now been defined:

 

DI1 will be allocated to external I/O digital input #1.

DO1 will be allocated to the on-board digital output #1.

DI2 will be allocated to external I/O digital input #2.

DO2 will be allocated to the on-board digital output #2.

 

 

5. Test the application in the RTCU Emulator

Let us test the project that we have created above. Click on the "Emulator" menu item, then "Emulator..." in the drop-down menu:

 

tutor-16

 

The Emulator window will appear as in the following:

 

modbus_sim_main

 

Enable the I/O window by clicking on "IO". This will bring up the following dialog:

 

modbus_sim_Dio

 

Please note that there are two devices in the "Devices" section. By default the window shows native inputs/outputs, but extended I/Os can be monitored by clicking on the "Dev1". The output variables "DO1" and "DO2" appears on the "Onboard/Output" section. Let us start the emulator by clicking on "Load & Run" on the emulator control window. The applications program is now running. As there are not applied any values to the inputs, DO1 and DO2 show "0". Click on "Dev1" and then activate "DI1" and "DI2" by clicking on the arrow next to them. The I/O control windows should now look like the following:

 

modbus_sim_dio_2

 

Observe the "DO1" and "DO2" by clicking on "Onboard" in the "Devices" list. These two outputs should look like:

 

modbus_sim_Dio_3

 

 

6. Transfer the application to a physical RTCU device

Transferring the application to a physical device is described in the Transfer to RTCU section. As the configured I/O Extension information is an integral part of the project, it will automatically be transferred to the device. If the device attached does not support the I/O Extension information, it will simply be ignored, and the application may not operate as intended.

 

 

7. Monitor I/O using the I/O Monitor dialog

The Device I/O Monitor fully supports the I/O Extension and on-board I/O as well, and remote I/O can easily be monitored. The following two figures show the I/O status of the project in this tutorial running in a physical device while "Onboard" and "Dev1" are selected in the "Devices" section:

 

 

modbus_iomon_onboard

 

modbus_iomon_dev1

 

 

This is the end of the tutorial. For further information on I/O Extension dialogs, please consult the sections Project Control - I/O extension, Project Control - I/O extension net, Project Control - I/O extension device, and Project Control - Setup Module.