beautypg.com

Coils, Input bits (1x references), 3 modbus messaging – Pulsafeeder Pulsar DLCM User Manual

Page 121: 4 pulsanet dde server messaging

background image

115

14.3 MODBUS Messaging

The MODBUS protocol was written for use with PLC’s. Programmable Logic Controllers (PLC’s)
typically have relay outputs, digital inputs, analog inputs, analog outputs and general system settings
(e.g., setpoints, alarm points, etc.). To access this data the MODBUS protocol uses the following basic
message structure (ASCII shown):

Start

Address

Function

Data

Check

End

1 Char

2 Char

2 Char

N Char

2 Char

2 Char

Start identifies the start of a message, Address contains the slave’s address, Function identifies the
function to perform, Data contains the data required by the Function, Check is the LRC or CRC checksum
of the message and End identifies the end of the message.

The FUNCTION CODE is the defining element in the message. It serves two purposes, 1) it defines an
operation, and 2) it identifies an optional block of data as the operand. When the FUNCTION CODE
operates on a block of data the ADDRESS of that data is transmitted in the DATA portion of the
message. For example to read the Digital Level Input from the DLC we would use FUNCTION CODE
0x02 and ADDRESS 0x000A. To read the analog input #1 we would use FUNCTION CODE 0x04 and
ADDRESS 0x0000.

These FUNCTION CODEs and associated data are organized into categories as follows:

MODBUS
Category

Function
Code(s)

Description

PulsaNet Application

COIL

0x01 (Read)

A relay output with either a 1 (ON)
or 0 (OFF) status.

Digital output, Alarm Relay
Status.

INPUT BITS

0x02 (Read)

A dry contact or open collector
input with either a 1 (ON) or 0
(OFF) status.

Keyboard KEYS, LEAK,
LEVEL and THERMOSTAT
switch inputs.

INPUT
REGISTER

0x04 (Read)

A16-bit Analog input.

4-20mA, Internal
Temperatures.

HOLDING
REGISTER

0x03 (Read)
0x06 (Write)
0x10 (Write
Multiple)

A 16-bit multipurpose register
value.

Display contents, keyboard,
counters and various status
and process variables.

Each MODBUS Category constitutes a block of data with ADDRESSES of 0x0000 to 0xFFFF.

The MODBUS protocol also supports FUNCTION CODEs that do not apply to data. For example,
FUNCTION CODE 0x11, REPORT SLAVE ID, returns identifying information about the SLAVE (e.g.,
gives Run Status, Prom Version and Serial Number).

14.4 PulsaNet DDE Server Messaging

Up to this point, this discussion is related specifically to MODBUS messaging. It would typically
concern someone developing an application that would communicate directly with the DLC/M. Most
users will access data through a Data Server like the PulsaNet DDE Server. To use such a program you
specify a data REFERENCE value. The server interprets the REFERENCE value to determine what
FUNCTION CODE and ADDRESS should be used. In the following Data Category tables, you will find
the FUNCTION CODE, ADDRESS and DDE REFERENCE relationships.