7
2.8 PROFIBUS Messaging Protocol
Overview
Since the PM130 transfer buffers only support 32 bytes or less transfer blocks, all of the
device registers cannot possibly be sent over PROFIBUS DP every scan. However, a
messaging mechanism allows a master to access all the device registers by placing a
command request pointing to the requested items in the output buffer and by receiving a
corresponding response in the input buffer.
Because PROFIBUS DP only supports cyclic data transfer between a master and a slave, a
master command is sent constantly from a PROFIBUS master to the PM130. The device
always handles read requests and the response block is normally updated every 20 ms,
however, a write request is handled only once, that is, the device ignores duplicate write
commands. This means that a write command sent multiple times would be handled only
once. To send a write command once again, toggle the synchronization bit in the control
word (see “Master Request Block” below) so the command frame would look different.
Data Types
Data transferred through the PROFIBUS input and output buffers is represented in big endian
format: the bytes are ordered from least significant at the highest address to most significant
at the lowest address. Data is always transferred in integer format. Negative numbers are
represented in 2-complement code.
A PROFIBUS master can request data either in 16-bit word format (unsigned UINT16 or
signed INT16 integers), or in 32-bit double word format (unsigned UINT32 or signed INT32
long integers). 32-bit integers are sent in two adjacent words – most significant at the lowest
address. Up to 14 words can be read or written by a single master request – 14 data items
using 16-bit format or 7 data items using 32-bit format.
The value range allowed for 16-bit data is 0 to 65535 for unsigned numbers and –32768 to
32767 for signed numbers. If the requested data exceeds a 16-bit word range, it is truncated
to the maximum allowable negative or positive number and the “over-range error” exception
code is set in the control word. When over-range occurs, an unsigned value is reported as
65535, a positive signed value as 32767 and a negative signed value as -32768. To avoid
over-range errors with 16-bit integers, linear scaling may be applied to analog data registers
(see “16-bit Scaled Data”). Scaling cannot be used with counters and bit-mapped binary
registers. Whether scaling is to be used or not is specified in the PROFIBUS master request.
Data Addressing
Device data registers are addressed using 16-bit point identifiers (ID) that are given
throughout this guide in four-digit hexadecimal notation.
In the master request and the device response messages, data addresses are defined by two
parameters: a start point ID that opens a data block being read or written, and a word count
that specifies the number of consecutive words in the block.
Master Request Block
The request block size can vary from 4 to 32 bytes. The actual size is defined when
configuring the PROFIBUS master for this device by selecting the OUTPUT module from the
device GSD file. Request formats for reading data from and writing data to the device are
shown in Tables 2-1 and 2-2. The first two words contain a control word and a point ID for
the first data item being accessed.
The requested data block size is specified in 16-bit words. In the event of 32-bit data, the
number of words must be even and would be twice the number of items being read or
written. Uneven word count will cause an “Invalid address” exception.