Message Mode is one of two modes that can be used with the RMC PROFIBUS-DP module. The other mode is called Compact Mode, which is described in Using the PROFIBUS-DP Compact Mode. Be sure to read both topics and consider each carefully before choosing the mode you will use.
Message Mode is so called because it imposes a messaging type interface on PROFIBUS-DP. That is, PROFIBUS-DP only supports cyclic data transfer between a master and a slave. However, the RMC has nearly 64K registers, all of which cannot possibly be sent over PROFIBUS every PROFIBUS scan. Therefore, blocks of these registers can be written to and read from the RMC by using a messaging mechanism: the request is placed in one block of registers, and a response is received in the other block of registers.
In addition to the Command and Response blocks of data, there is also a third block of data—the Status Block—that includes status information that is constantly available. A summary of the Message Mode register blocks follows:
Status Block
This is a block of 32 contiguous input registers that are constantly updated by the RMC. The values will be updated every 2ms when no commands are in progress, and every 6ms when a command is in progress. This block is otherwise independent from the Command and Response blocks. The contents of these 32 registers are configurable using the Status Map editor. See Using the Status Map Editor for details.
Command Block
This is a block of 64 contiguous output registers. These registers are sent from the PLC or PC to the RMC constantly via PROFIBUS-DP, however, the last register in this block contains two flag bits that are toggled to indicate a request. The command block is described in further detail below.
Note: Users of Compact Mode should be aware that commands issued over Message Mode are always handled. Specifically this means that if you send a command multiple times it will be processed every time it is received. Under Compact Mode duplicate commands are ignored. This means that Compact Mode users who want to re-issue a command (for example, an ’E’ command to start an event sequence) need to toggle the case of the command (for example, toggle between ’E’ and ’e’).
Response Block
This is a block of 64 contiguous input registers. These registers are sent from the RMC to the PLC or PC constantly via PROFIBUS-DP, however, the values will not change unless a new request was triggered using the flag bits in the last register of the command block. This mechanism is described below.
Therefore, Message Mode requires 96 input words and 64 output words on the PROFIBUS master. Not all PROFIBUS masters support this; if your master does not support this many registers, you will need to use Compact Mode.
Messaging in Greater Detail
The Command Block has the following structure:
Register |
Description |
0-58 |
Write Data |
59 |
Write address (0-65,535). See the RMC Register Map (PROFIBUS-DP Message Mode) topic for a description of all RMC registers and their addresses. |
60 |
Write length (in words; 0-59) |
61 |
Read address (0-65,535). See the RMC Register Map (PROFIBUS-DP Message Mode) topic for a description of all RMC registers and their addresses. |
62 |
Read length (in words; 0-63) |
63 |
Output Synchronization Register: Bit 15 - Read Request Bit 14 - Write Request |
The Response Block has the following structure:
Register |
Description |
0-62 |
Read Data |
63 |
Input Synchronization Register Bit 15 - Read Acknowledge Bit 14 - Write Acknowledge |
To request a read from the RMC, use the following steps:
Wait until the Read Request bit is equal to the Read Acknowledge bit. If they are not equal, the RMC is currently processing a read request.
Set the Read Address and Read Length output registers. See RMC Register Map (PROFIBUS-DP Message Mode) topic for a description of all RMC registers and their addresses.
Toggle the Read Request bit.
Wait until the Read Request bit is equal to the Read Acknowledge bit. When they are equal, the RMC will have updated the Read Data area with the requested data.
Use the data in the Read Data area of the Response Block input registers. Make sure that you do not change the Read Request bit until you are done with the data in the Read Data area.
To request a write to the RMC, use the following steps:
Wait until the Write Request bit is equal to the Write Acknowledge bit. If they are not equal, the RMC is currently processing a write request.
Copy the values you wish to write to the RMC into the Write Data area of the Command Block output registers.
Set the Write Address and Write Length output registers. See RMC Register Map (PROFIBUS-DP Message Mode) topic for a description of all RMC registers and their addresses.
Toggle the Write Request bit.
Wait until the Write Request bit is equal to the Write Acknowledge bit. When they are equal, the RMC has received the data written to it.
The RMC processes reads and writes separately. That is, it is not necessary for a write to complete before starting a read, and in fact, you can simultaneously request both a read and a write; the write to the RMC will occur first, and the read from the RMC will occur after the write has completed. When both are done, both acknowledge bits will be toggled simultaneously.
To further clarify the ordering, keep these basic rules in mind in Message Mode:
Do change all write data, the write address, and the write length before toggling the Write Request bit.
Do change the read address and read length before toggling the Read Request bit.
Do not change the Read Request bit after a read request until you have processed the data in the Read Data area.
Do not change the write data, the write address, or the write length when the Write Request bit in the output synchronization register does not match the Write Acknowledge bit in the input synchronization register.
Do not change the read address or the read length when the Read Request bit in the output synchronization register does not match the Read Acknowledge bit in the input synchronization register.
Using Splines with PROFIBUS
Wait bit 7 is used by the Profibus DP communications so the user can tell when spline downloads are finished. The Profibus DP spline processing routine sets wait bit 7 when a download to the spline area is detected. The user can then use the step table and the Check Wait Bits link to be sure the spline is ready before executing the spline.
Copyright (c) 1997-2015 by Delta Computer Systems, Inc.