SIMATIC - IntelliSense With S7-1200 Modbus RTU

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Application Note

Application Note

IntelliSense Application Note 3


Messaging between Bimba IntelliSense SIM Module and Siemens S7-1200 PLC

Table of Contents
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . 3
HARDWARE SETUP. . . . . . . . . . . . . . . . . . . . . 3
MODBUS RTU CONFIGURATION . . . . . . . . . . . 4
MODBUS DATA LAYOUT . . . . . . . . . . . . . . . . . 5

02/24/15

rev1.0 2

Application Note
Introduction

This application note is intended to be used in conjunction with sample code file App_Note_S7_1200_
CM_1200 and serves as an example for basic Modbus RTU communication. The main hardware used
for this example was a Siemens S7-1200 PLC, Bimba IntelliSense Starter Kit (ISK-SMA_), with a Bimba
IntelliSense Junction Block (ISH-R04). The Siemens sample code MODBUS_RTU_V11 SP2 Upd5 was
used as a programing template, and the Siemens manual s71200_system_manual_en-US_en-US.pdf was
used for reference.

Hardware Setup

For this example, a 2-wire RS-485 Modbus network was implemented using the IntelliSense Junction
Block. SIM DIP switches 5 and 6 were set high to tie the RX/TX terminals together. DIP switch 7 was also
set high to enable the internal 150 ohm terminating resistor. Power for the SIM unit was supplied using
pins 7 and 8 of the junction block.

(Wire colors are not representative of actual cable.)

02/24/15

rev1.0 3

Application Note
Modbus RTU Configuration

Modbus RTU is a serial Master-Slave protocol. This means the Master device (PLC in this case) controls
when each Slave device on the network acts upon the Masters commands. Only one Slave device can
transmit back to the Master at a time. There can be a maximum of 32 devices on a RS485 Modbus RTU
network.
The IntelliSense SIM unit is capable of utilizing a variety of 8 bit serial communication configurations.
A baud rate of 9,600 bps, no-parity, 8 bit, and 1 stop bit configuration was set in the SIM. The CM1241 module was set for half-duplex (2-wire) mode in the properties section of the module. All other
communication settings are set when the program runs. See Network 1 for Communications Initialize
block. You may adjust these settings for your application, but the settings must match on all devices on
the Modbus RTU network. Keep in mind the Modbus Master assumes the address value of 0.

CM-1241 Module

IntelliSense SIM

02/24/15

rev1.0 4

Application Note
Modbus Data Layout

The Modbus RTU protocol defines how the data registers of a Modbus device are laid out. The
IntelliSense SIM unit currently only utilizes Holding Registers.
0x = Coil = 00001-09999
1x = Discrete Input = 10001-19999
3x = Input Register = 30001-39999
4x = Holding Register = 40001-49999
The Holding Registers of the IntelliSense SIM units are defined using the following table:
Register Description

Size

40001

Pressure of port 1 in absolute tenths of PSIa

2 Bytes

40002

Pressure of port 2 in absolute tenths of PSIa

2 Bytes

40003

Ambient pressure in absolute tenths of PSIa

2 Bytes

40004

Pressure of port 1 in absolute tenths of mBar

2 Bytes

40005

Pressure of port 2 in absolute tenths of mBar

2 Bytes

40006

Ambient pressure in absolute tenths of mBar

2 Bytes

40007

Line pressure in absolute tenths of PSIa

2 Bytes

40008

Line pressure in absolute tenths of mBar

2 Bytes

40009

Rod Position

2 Bytes

40010

Time in ms for last extension event

2 Bytes

40011

Time in ms for last retraction event

2 Bytes

40012

Temperature of port 1 in hundredths of a F

2 Bytes

40013

Temperature of port 2 in hundredths of a F

2 Bytes

40014

Temperature of port 1 in hundredths of a C

2 Bytes

40015

Temperature of port 2 in hundredths of a C

40016

Register Description
40024

Leakage Failure

Size
2 Bytes

Bit 0 - Rear Piston Seal


Bit 1 - Front Piston Seal
Bit 2 - Rod Seal
40025

Temperature Failure

2 Bytes

Bit 0 - 1 Temp High


Bit 1 - 1 Temp Low
Bit 2 - 2 Temp High
Bit 3 - 2 Temp Low
40026

Extent Failure

2 Bytes

Bit 0 - Extend Time High


Bit 1 - Extend Time Low
Bit 2 - Retract Time High
Bit 3 - Retract Time Low
40027

Estimated Life Remaining above 90% - Bit 0


Estimated Life Remaining below 10% - Bit 1

2 Bytes

2 Bytes

40028

2 Bytes

Cycle count, low word

2 Bytes

Estimated Life Remaining Percentage between


90 and 10 Decimal value

40017

Cycle count, high word

2 Bytes

40029

Life Expected Thresholds

2 Bytes

40018

Cycle count limit, low word

2 Bytes

40019

Cycle count limit, high word

2 Bytes

40020

First two bytes of SIM revision

2 Bytes

40021

Second two bytes of SIM revision

2 Bytes

40022

Sensor Status

2 Bytes

Bit 0 - 1 Streaming
Bit 1 - 2 Streaming
Bit 3 - 1 Recognized
Bit 4 - 2 Recognized
40023

Pressure Failure
Bit 0 - Line Pressure High
Bit 1 - Line Pressure Low
Bit 2 - Sensor 1 Pressure High
Bit 3 - Sensor 1 Pressure Low
Bit 4 - Sensor 1 Pressure High
Bit 5 - Sensor 1 Pressure Low

02/24/15

2 Bytes

Bit 0 - Yellow Light Threshold


Bit 1 - Red Light Threshold
40030

Estimated Cycles remaining, low word

2 Bytes

40031

Estimated Cycles remaining, high word

2 Bytes

40032

Estimated Days Remaining

2 Bytes

40501

RTC Seconds

2 Bytes

40502

RTC Minutes

2 Bytes

40503

RTC Hours (24hr)

2 Bytes

40504

RTC Hours (12hr)

2 Bytes

40505

RTC AM/PM

2 Bytes

40506

RTC Day

2 Bytes

40507

RTC Month

2 Bytes

40508

RTC Year (last 2 digits)

2 Bytes

40510

ID 1 String

60 Bytes

40540

ID 2 String

40 Bytes

40560

Part Number

30 Bytes

rev1.0 5

Application Note
A Modbus Master transmits function codes to specific Modbus Slave addresses. Each function has its own
code number:
01
Read Coils
02
Read Discrete Inputs
03
Read Holding Registers
04
Read Input Register
05
Write Single Coil
06
Write Single Register
The IntelliSense SIM module only supports the Read Holding Register (function 3). This function code
allows you to poll the network Slave for the current values in a single register or a consecutive series of
registers using a single command. For this example, two (2) message requests are sent to Slave address 1.
The first request polls registers 1-32 and the second requests the same data. This could easily be adjusted
to poll multiple SIMs.

Comms Initialization

02/24/15

rev1.0 6

Application Note
Message 1 Setup

Message 2 Setup

02/24/15

rev1.0 7

Application Note
The values returned from the SIM unit are configured to populated integer register DB3.DBX6.0 Master_
data.Receive.
This example solution can be adapted for increased message requests to include multiple Modbus Slave
addresses. After copying networks 6-7 and pasting them after the current rung seven (7), change the In
value of the MOV instruction located on rung seven (7) to the next consecutive message step, and adjust
the three (3) new EQU conditions so that the compared value is equal to the new message step value.
Keep in mind the new message instruction will have to be setup with the Data Table Address in the PLC,
number of elements, beginning location of data registers being polled, and correct Slave address.

02/24/15

rev1.0 8

You might also like