Siemens SIMATIC S7-200 System Manual page 103

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

Start and End Conditions for the Receive Instruction
The Receive instruction uses the bits of the receive message control byte (SMB87 or SMB187) to
define the message start and end conditions.
Tip
If there is traffic present on the communications port from other devices when the Receive
instruction is executed, the receive message function could begin receiving a character in the
middle of that character, resulting in a possible parity error and termination of the receive
message function. If parity is not enabled the received message could contain incorrect
characters. This situation can occur when the start condition is specified to be a specific start
character or any character, as described in item 2. and item 6. below.
The Receive instruction supports several message start conditions. Specifying a start condition
involving a break or an idle line detection avoids this problem by forcing the receive message
function to synchronize the start of the message with the start of a character before placing
characters into the message buffer.
The Receive instruction supports several start conditions:
1.
Idle line detection: The idle line condition is defined as a quiet or idle time on the
transmission line. A receive is started when the communications line has been quiet or idle
for the number of milliseconds specified in SMW90 or SMW190. When the Receive
instruction in your program is executed, the receive message function initiates a search for
an idle line condition. If any characters are received before the idle line time expires, the
receive message function ignores those characters and restarts the idle line timer with the
time from SMW90 or SMW190. See Figure 6-11. After the idle line time expires, the receive
message function stores all subsequent characters received in the message buffer.
The idle line time should always be greater than the time to transmit one character (start bit,
data bits, parity and stop bits) at the specified baud rate. A typical value for the idle line time
is three character times at the specified baud rate.
You use idle line detection as a start condition for binary protocols, protocols where there is
not a particular start character, or when the protocol specifies a minimum time between
messages.
Setup:
il = 1, sc = 0, bk = 0, SMW90/SMW190 = idle line timeout in milliseconds
Characters
Restarts the idle time
Receive instruction is executed:
starts the idle time
Figure 6-11
Using Idle Time Detection to Start the Receive Instruction
2.
Start character detection: The start character is any character which is used as the first
character of a message. A message is started when the start character specified in SMB88
or SMB188 is received. The receive message function stores the start character in the
receive buffer as the first character of the message. The receive message function ignores
any characters that are received before the start character. The start character and all
characters received after the start character are stored in the message buffer.
Typically, you use start character detection for ASCII protocols in which all messages start
with the same character.
Setup:
il = 0, sc = 1, bk = 0, SMW90/SMW190 = don't care, SMB88/SMB188 = start
character
S7-200 Instruction Set
Characters
First character placed in the
message buffer
Idle time is detected:
starts the Receive Message function
Chapter 6
89

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents