Siemens SIMATIC S7-200 System Manual page 106

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

Advertisement

S7-200 Programmable Controller System Manual
Characters
Start of the message:
Starts the message timer
Figure 6-13
Using the Message Timer to Terminate the Receive Instruction
4.
Maximum character count: The Receive instruction must be told the maximum number of
characters to receive (SMB94 or SMB194). When this value is met or exceeded, the receive
message function is terminated. The Receive instruction requires that the user specify a
maximum character count even if this is not specifically used as a terminating condition.
This is because the Receive instruction needs to know the maximum size of the receive
message so that user data placed after the message buffer is not overwritten.
The maximum character count can be used to terminate messages for protocols where the
message length is known and always the same. The maximum character count is always
used in combination with the end character detection, intercharacter timer, or message
timer.
5.
Parity errors: The Receive instruction is automatically terminated when the hardware
signals a parity error on a received character. Parity errors are only possible if parity is
enabled in SMB30 or SMB130. There is no way to disable this function.
6.
User termination: The user program can terminate a receive message function by executing
another Receive instruction with the enable bit (EN) in SMB87 or SMB187 set to zero. This
immediately terminates the receive message function.
Using Character Interrupt Control to Receive Data
To allow complete flexibility in protocol support, you can also receive data using character interrupt
control. Each character received generates an interrupt. The received character is placed in
SMB2, and the parity status (if enabled) is placed in SM3.0 just prior to execution of the interrupt
routine attached to the receive character event. SMB2 is the Freeport receive character buffer.
Each character received while in Freeport mode is placed in this location for easy access from the
user program. SMB3 is used for Freeport mode and contains a parity error bit that is turned on
when a parity error is detected on a received character. All other bits of the byte are reserved. Use
the parity bit either to discard the message or to generate a negative acknowledgement to the
message.
When the character interrupt is used at high baud rates (38.4 kbaud to 115.2 kbaud), the time
between interrupts is very short. For example, the character interrupt for 38.4 kbaud is
260 microseconds, for 57.6 kbaud is 173 microseconds, and for 115.2 kbaud is 86 microseconds.
Ensure that you keep the interrupt routines very short to avoid missing characters, or else use the
Receive instruction.
Tip
SMB2 and SMB3 are shared between Port 0 and Port 1. When the reception of a character on
Port 0 results in the execution of the interrupt routine attached to that event (interrupt event 8),
SMB2 contains the character received on Port 0, and SMB3 contains the parity status of that
character. When the reception of a character on Port 1 results in the execution of the interrupt
routine attached to that event (interrupt event 25), SMB2 contains the character received on
Port 1 and SMB3 contains the parity status of that character.
92
Characters
The message timer expires:
Terminates the message and generates the
Receive Message interrupt

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents