Siemens CPU 948 Programming Manual page 386

Simatic s5 s5-155u
Table of Contents

Advertisement

Memory Access via Address in ACCU 1
Example 2 continued:
Flag assignment:
FW 10:
Bits 4 to 19 of the start address of the DB/DX (points to DW 0)
FW 12:
Length of the DB/DX (number of data words)
FD 14:
Address of the last data word in the DB/DX + 1 (physical address)
FB
6
SEGMENT 1
NAME :FILL DB
0005
:
0006
:L
DH
0009
:L
KF
000B
:+D
000C
:
000D
:LIR
000E
:T
FW
000F
:L
KB
0010
:!=F
0011
:JC
=NIVO
0012
:
0013
:L
FW
0014
:SLD
0015
:L
KB
0016
:-D
0017
:LIR
0018
:ADD
BN
0019
:
001A
:T
FW
001B
:
001C
:L
FW
001D
:L
FW
001E
:SLD
001F
:+D
0020
:T
FD
0021
:
0022
:L
KH
0024
:
0025
:L
FD
0026
:ENT
0027
:
0028
:L
FW
0029
:SLD
002A
:
002B SCHL
:
002C
:
002D
:
002E
:
002F
:TIR
0030
:
0031
:
0032
:ADD
DH
0035
:
0036
:><D
0037
:JC
=SCHL
0038
:
0039 WEIT
:
003A
:
003B
:
003C
:BEU
003D
:
003E NIVO
:
003F
:BE
9 - 16
0000
Writing a DB with a constant
! Required flags: FY 10 to FY 17
000E EC00 Start addr. of the DB list
+100
plus the DB number
= Address list entry of DB 100
(Bits 4 to 19)
1
Start addr. DB 100 to ACCU 1
10
Buffer start addr.
0
(Paragraph address)
If start addr. = 0, then
DB does not exist
10
Start addr. of DB (1st DW)
4
Convert addr. to physical address
1
Find out DB length via
5th word in block header
1
Length including block header to ACCU 1
-5
Number of DWs = total length - 5 words (header)
12
Buffer length
12
Number of data words +
10
start address (DW 0 converted to
4
physical address)
produces
14
address of the last DW + 1
A5A5
Constant, written to all data words
14
Address of the last DW + 1
Shift constant to ACCU-3-L
(= register 10)
10
Convert address of 1st data word (DW 0)
4
to physical address
Loop:
ACCU 1: address of DW to be written to
ACCU 2: address of last DW + 1
ACCU 3: constant
10
Store the value of ACCU-3-L in the DW with
the address in ACCU 1
0000 0001
Increment address by 1
Scan whether last DW reached
(if not, return to the loop)
Continue the program ...
after all DWs have been written to ...
If DB 100 does not exist
!
CPU 948 Programming Guide
C79000-G8576-C848-04

Advertisement

Table of Contents
loading

Table of Contents