Specifications

SIMATIC Instructions
9-189
S7-200 Programmable Controller System Manual
C79000-G7076-C233-01
Receive and Transmit Example
This sample program shows the use of Receive and Transmit. This program will
receive a string of characters until a line feed character is received. The message
is then transmitted back to the sender.
LAD
STL
SMB30
SM0.1
MOV_B
EN
IN
16#9
OUT
Network 1
LD SM0.1
MOVB 16#9, SMB30
MOVB 16#B0, SMB87
MOVB 16#0A, SMB89
MOVW +5, SMW90
MOVB 100, SMB94
ATCH 0, 23
ATCH 1, 9
ENI
RCV VB100, 0
On the first scan:
- Initialize freeport
- Select 9600 baud
- Select 8 data bits
- Select no parity
RCV
TBLVB100
EN
SMB87
MOV_B
EN
IN
16#B0
OUT
Network 1
PORT0
Initialize RCV message
control byte
- RCV enabled
- Detect end of message
character
- Detect idle line condition
as message start
condition
SMB89
MOV_B
EN
IN16#A OUT
SMW90
MOV_W
EN
IN+5 OUT
SMB94
MOV_B
EN
IN100 OUT
ATCH
INT0
EN
EVNT23
ATCH
INT1
EN
EVNT9
Set end of message
character to hex 0A
(line feed)
Set idle line timeout to
5 ms.
Set maximum number of
characters to 100.
Attach interrupt to
receive complete event.
Attach interrupt to
transmit complete event.
ENI
Enable user interrupts.
Enable receive box with
buffer at VB100 for port 0.
ENO
ENO
ENO
ENO
ENO
ENO
ENO
ENO
MAIN (OB1)
Figure 9-74 Example of Transmit Instruction