Siemens Simatic S7-200 System Manual page 318

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

Advertisement

Instruction Set
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.
Network 1
SM0.1
16#B0
VB100
Figure 10-59 Example of Transmit Instruction
10-130
LAD
On the first scan:
MOV_B
- Initialize freeport
EN
- Select 9600 baud
- Select 8 data bits
- Select no parity
16#9
IN
OUT
SMB30
Initialize RCV message
MOV_B
control byte
EN
- RCV enabled
- Detect end of message
character
IN
OUT
SMB87
- Detect idle line condition
as message start
condition
MOV_B
EN
Set end of message
character to hex 0A
(line feed)
16#A
IN
OUT
SMB89
Set idle line timeout to
MOV_W
5 ms
EN
+5
IN
OUT
SMW90
Set maximum number of
MOV_B
characters to 100
EN
100
IN
OUT
SMB94
Attach interrupt to
ATCH
receive complete event
EN
0
INT
23
EVENT
ATCH
Attach interrupt to
transmit complete event
EN
1
INT
9
EVENT
Enable user interrupts
ENI
Enable receive box with
RCV
buffer at VB100 for port 0
EN
TABLE
0
PORT
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
S7-200 Programmable Controller System Manual
C79000-G7076-C230-02
STL

Advertisement

Table of Contents
loading

Table of Contents