Operator Interface Tech Note 32 - TNOI32
Abstract
This document provides an introduction to connecting two Crimson-programmed Red Lion devices via Modbus.
Products
CR1000 HMI, CR3000 HMI, DSP, G3 HMI, G3 Kadet HMI, Graphite Controller,
Graphite HMI, Modular Controller, and PTV
Use Case
This document provides an introduction to connect a G3 HMI to a Modular Controller CSMSTRV2 using Modbus Serial Communication. This setup can be duplicated between any of the products listed above, although using OPC communication would be a better option in these cases that do not involve the CSMSTRV2. A technical note regarding the OPC set up can be found on Red Lion website here:
https://redlioncontrols.zendesk.com/hc/en-us/articles/360012121092
The following description will not go through the Modular Controller modules set up and will assume knowledge of each modules parameters from the user. Please refer to the Modular Controller manual for module setup and parameter purpose.
This document shows instructions for Crimson 2.0, but the same steps are followed in Crimson 3.0 and 3.1.
Required Software
Crimson 2.0, 3.0, or 3.1
Introduction
Modbus protocol is widely used in the industry and has become a standard for device-to-device
communication. Many PLC programmers or users know the basics of this protocol and its flexibility and ease of use makes it the perfect communication tool to exchange data between Red Lion Products. This also provides compatibility with other products supporting Modbus that could eventually be attached to the same bus. Modbus is a single master multiple slave protocol. The G3 will be the master in this example.
Multiple transports are supported by Modbus: RS232, RS485 or TCP/IP. The latest has it’s own protocol called Modbus TCP/IP. The following set up can be duplicated on any transports mentioned above with the only difference being the driver between serial and TCP/IP. Crimson 2.0 will only provide the drivers related to the transport during setup, thus avoiding errors.
Figure 1 shows the 3 different transports available and the drivers to be selected in each case. The following cables can be used for each communication:
• RS232: CBLRLC01 or CBLRLC02 (1' or 10' length respectively)
• RS485: CBLRLC05
• TCP/IP: Standard Crossover Ethernet Cable for Point-to-Point or Straight Ethernet Cable if
connected via a Switch.
Figure 1.
Slave (Modular Controller) Setup
Creating a Modular Controller Database
The first step is to create a Modular Controller database. In Crimson 2.0, click on File>New and select Modular Controller for the Product Family and CSMSTRV2 for the Model, see Figure 2.
Figure 2.
Enter in the area named Modules to insert the Modular Controller modules that fit the application. This step is required before the communication setup as data available for Modbus depends on the modules inserted.
For this example, a CSPID2 and CSTC8 module are inserted, see Figure 3.
Figure 3.
The module(s) can be programmed now or later. It will not influence data availability on the communication but only data formats when creating tags in the G3. For example, if the CSPID input is a thermocouple, the format will include one digit after the decimal point (000.0) where a process input might include two digits after the decimal point (000.00).
NOTE: This format does NOT influence Modbus as the Modular Controller transfers whole numbers (integers) and the decimal point is just a “dummy” point inserted on the display. I.E. For a temperature of 35.6 F, the register value will be 356.
Communication Settings
Once the modules are set up, double-click the Master to close this section and open the Communications area. This example will use RS232 as a transport but it can be duplicated on any transports as long as the cable used and the driver associated are correct as shown in Figure 1.
The Modular Controller has to be set up as a Modbus Slave since the G3 will be the master.
Select the RS232 Port and click the Edit button under the Driver Selection. This will open the driver picker popup window. Select Modbus under manufacturer and RTU Slave under Driver, refer to Figure 4. Click OK.
Figure 4.
A device called PLC1 now appears under the communication Port. This device represents the Modbus Master device, in our case, the G3. The device can be renamed for simpler usage. In this example, the name is changed to G3, see Figure. 5.
Figure 5.
Port settings can be adjusted to achieve faster communication (higher Baud Rate). If these settings are changed, they will have to match the G3 settings set up later.
Creating Data Blocks
In order to exchange data with the Modbus master, the Modular Controller has to make data available in Modbus register addresses. This is done using Crimson 2.0 Data Blocks.
Blocks are given a direction, MC to Device (Reading) or Device to MC (Writing). The Modbus master can only read from a Reading block but can read and write from a Writing block. For example, temperature readings should be linked to a reading block. On the other hand, setpoints or other adjustable data are linked to a writing block.
NOTE: In build 287 or earlier, the term MC in direction did not exist and was replaced by G3. This G3 still referred to the device programmed, in this example, the Modular Controller.
Creating a Reading Block
Select the device named G3 under the RS232 communication port and click on the Add Gateway Block button. A new block named Block1 is created. Select the block and click the Edit button next to the Start address, see Figure 6.
In this example, we will use Holding Registers to exchange data. Select Holding Register and enter Element 1.
Figure 6.
Click OK and then the Edit button is available next to the Block Size. Click the Edit button and enter the block dimension in the number of registers. Referring to Figure 7, we use 5. Click OK.
Figure 7.
All the registers for the block now appear under Block1. From Start Address to Start Address + Block Size –1. Each register can now be linked to a Modular Controller module parameter. The direction is left as default.
Select the first register (400001). The right-hand side pane now displays available modules. Extend the Backplane and select Module1>Loop1>Status>PV (Loop1 Input process value), see Figure 8.
Figure 8.
Drag and drop the PV to register 400001. This Modbus register is now linked to this specific parameter. A small arrow in the center shows the direction data is transferred, i.e. MC to Modbus, so the master can only read this block. The block can be completed with more data from over modules as shown in Figure 9.
Figure 9.
Creating a Write Block
Select the device named G3 under the RS232 communication port and click on the Add Gateway Block button. A new block named Block2 is created. Select the block and click the Edit button next to the Start address.
In this example, we will use Holding Registers to exchange data as we did for the Reading block. Select Holding Register and enter Element 101, see Figure 10.
Figure 10.
Click OK and then the Edit button is available next to the Block Size. Click the Edit button and enter the block dimension in the number of registers. Referring to Figure 11, we use 2. Click OK.
Figure 11.
All the registers for the block now appear under Block2. From Start Address to Start Address + Block Size –1.
Click the Edit button next to the direction and change it to Device to MC, see Figure 12. Click OK twice. The block turns red.
Figure 12.
Each register can now be linked to a Modular Controller module parameter. Select the first register (400101). The right-hand side pane now displays available modules. Referring to Figure 13, extend the Backplane and select Module1>Loop1>Control>ReqSP (Loop1 setpoint).
Figure 13.
Drag and drop the ReqSP to register 400101. This Modbus register is now linked to this specific parameter. A small arrow in the center shows the direction data is transferred, i.e. both ways, so the master can read and write data in this block. The block can be completed with more data from over modules as shown in Figure 14.
Figure 14.
The Modular Controller set up is now complete. Save and download the database in the device.
Master (G3) Setup
To create a new G3 database, in Crimson 2.0, click on File>New and select G3 Series for the Product Family and the corresponding G3 model for your application. This example will use a G310 but the setup is similar on all Crimson based products.
Communication Settings
The first step is to program the communication settings to match the Modular Controller.
Enter the Communications module and select the RS232 communication port. Click the Edit button under the Driver Selection. This will open the driver picker popup window. Referring to Figure 15, select Modbus under manufacturer and Universal Master under Driver. Click OK.
Figure 15.
The RS232 communication port now displays the driver and port settings. These have to be adjusted to match the Modular Controller. In this example, default settings are correct.
A device called PLC1 appeared under the Communication Port. This device represents the Modbus Slave device, in our case, the Modular Controller. The device can be renamed for simpler usage. In this example, the name is changed to MC, see Figure 16.
Figure 16.
When this device is selected, the right-hand pane shows the different device settings available such as drop number and protocol options. These will only affect the selected device. Default setting fits this example.
Communication setup is now complete. Data Tags can be created to access the MC values.
Creating Data Tags
Close the Communications module and enter the Data Tags module. We will first create a variable to read the temperature for Loop1 in the Modular Controller.
Reading Variable
Crimson 2.0: Click on the Integer Button under Create New Variable. A new variable named Var1 appears on the left pane.
Crimson 3.0/3.1: Create a new Numeric Tag.
Rename the variable/tag to TempLoop1, see Figure 17.
Figure 17.
When the variable is selected, the right-hand pane displays the variable settings in multiple tabs. The variable now has to be linked to the Modular Controller.
In the General tab, click the Internal button next to mapping and select MC. A popup window appears and shows the available registers for Modbus RTU master. This variable has to be linked to the Module1.Loop1.PV. In the Modular Controller database set up earlier, the Modbus address linked to this parameter is 400001.
Referring to Figure 18, Select Holding Registers under Data item and enter element 1. Click OK.
Figure 18.
This variable is now mapped to Modbus register 400001 in the device MC. The cross symbol next to the variable is now red. This informs the user that the variable is mapped to a device and can be read or written by the G3. However, since this variable is in a read block in the Modular Controller, its access has to be changed to Read Only.
The access is available under the mapping. Once changed, a read-only access is displayed as a green symbol next to the variable.
NOTE: Putting a variable in read-only provides Crimson a mean to check and inform the user if the database tries to write in the mapped area, thus avoiding errors for data that shouldn’t be written.
Writing variable
This is similar to the Reading variable setup. Click on the Integer Button under Create New Variable. A new variable named Var1 appears on the left pane. Rename the variable to StpLoop1.
Select the variable and in the General tab, click the Internal button next to mapping and select MC. This variable has to be linked to the Module1.Loop1.ReqSP. In the Modular Controller database set up earlier, the Modbus address linked to this parameter is 400101.
In the popup window, select Holding Registers under Data item and enter element 101. Click OK.
This variable is now mapped to Modbus register 400101 in the device MC. The cross symbol next to the variable is now red. This informs the user that the variable is mapped to a device and can be read or written by the G3.
Since this variable represents the Setpoint and can be changed from the HMI, the access is left to Read and Write.
Figure 19 shows a set of variable mapped in reference to the Modular Controller setup.
Figure 19.
In the format tab, the format for each variable can be adjusted. In this example, the number of digits after the decimal point should be set to 1. Please refer to the Modular Controller manual to identify the format required for the variable.
Data Tags setup is now complete.
Displaying Information on the Screen
Close the Data Tags module and enter the User Interface module.
Crimson 2.0: Click on the screen to display the drawing box. Click on Insert>Tag or on the tag icon in the drawing box to open the Select Tag dialog box. Select the first tag (TempLoop1) and click OK, refer to Figure 20.
Crimson 3.0/3.1: Select the desired tag from the Resource Pane.
Figure 20.
Click and drag on the screen to insert the tag.
Insert each tag on the screen in the same manner, see Figure 21.
Figure 21.
To make the setpoint tags changeable by the user, double-click on the setpoint tag on the screen to display the properties and change Data Entry to Yes, see Figure 22.
Figure 22.
The G3 is now ready to read and write data from the Modular Controller. Save the database and download it into the unit. Connect the cable and communication should start.
Communication Summary
Figure 23 shows the data exchange taking place between the G3 and the MC via Modbus RTU.
Figure 23.
Disclaimer
It is the customer's responsibility to review the advice provided herein and its applicability to the system. Red Lion makes no representation about specific knowledge of the customer's system or the specific performance of the system. Red Lion is not responsible for any damage to equipment or connected systems. The use of this document is at your own risk. Red Lion standard product warranty applies.
Red Lion Technical Support
If you have any questions or trouble contact Red Lion Technical Support by clicking here or calling 1-877-432-9908.
For more information: http://www.redlion.net/support/policies-statements/warranty-statement