Professional Documents
Culture Documents
Terminology
Offline program The program that is stored on the hard disk of the computer. This will
contain the documentation. Its very important to keep a pristine copy of the offline program
as the associated documentation is not stored in the PLC.
Online program This is the program resident in the PLC.
Download The act of taking the offline program on the computer and downloading it into
the PLC.
Upload Taking the program in the PLC and bringing it up to the computer. Doing this
without having the associated offline program open will cause a loss of documentation.
Save Stores the open block onto the hard drive. Its important to realize that an edited block
can be downloaded to the PLC without saving it offline. Note that this only saves the opened
block and not any others that are concurrently open.
These may seem like simple terms but its important to understand how theyre used in the
Siemens environment.
Here are some other terms that may come up.
PG/PC This is Siemens way of referring to a PC or laptop running the SIMATIC software.
Nodes Refers to any programmable device (in our case a PLC) in the network which will
have its own unique address.
Best Practice
The best practice is to make sure you are working from an offline file. There really isnt any
reason to be working on the program inside the PLC. Of course, this assumes that you have a
good working copy to begin with. The golden copy of the program should live somewhere on
a network server or have a dedicated place on one computer or laptop. Ive even heard of
some companies using USB memory sticks to store the latest and greatest which is great but an
original copy should still live on a computer that is backed up.
1. Open the offline file from the File pull down menu and select Open or use the
Open Project icon
on the toolbar. In the dialog box select the project
under the User Project tab. Click OK. You may have to select Browse to find it in the
directory structure. Note if the Manager was closed with a project open then it will open
back up to that project automatically.
2. Expand the project tree down to the program files and select the Blocks
folder. Good practice dictates that all blocks should be opened from here.
3. Once changes have been made:
1. Save the block to the hard disk by clicking the Save icon
(or menu item
File | Save)
2. Download the block by clicking the Download icon
(or menu item PLC |
Download). If the block all ready exists in the PLC then it will confirm that you want
to overwrite it 1 . Click Yes.
3. Note that downloading from here only sends that one block to the PLC. It does not
download the entire program.
4. To monitor the block make sure to open it using steps 1 through 3 and then
press the Monitor icon
(or menu item Debug | Monitor). The windows title bar will
highlight a lovely shade of blue to indicate a connection to the CPU. Its important to
note here that you are still working with the program on the computer and not the PLC.
If the procedure in step 3 has not been followed then discrepancies can occur between
what you are monitoring in the PLC and what is displayed in the SIMATIC software.
Thats it. Following these simple steps will save a lot of headaches.
These dialog boxes are telling you that it cannot find the documentation for the local
parameters and symbols. More then likely it will also not show any network comments or titles.
The result of opening the block looks like this
This is an example void of documentation. Notice the local parameters all say TEMP. There
are no comments or titles. There are no symbols so its all in direct addressing. The properly
documented copy looks like this...
Conclusion
Programming with SIMATIC Step 7 is different enough from other types of PLCs to throw off
the casual user. Always working from the offline copy will make it less likely to screw up.
Opening up a block from the accessible nodes window is always a no-no. Likewise, opening a
block from a window that has a highlighted blue title bar will also cause potential problems. Be
sure and read all dialog boxes especially the ones weve shown in the article. Avoid the pitfalls
and keep that documentation. Mystery solved.
Footnote:
(1) Siemens dialog boxes have an option that says, Do not display this message again. This
http://www.plcdev.com/book/export/html/410[14/12/2015 09:15:38 p.m.]
is handy for some annoying pop ups but it is really not a good idea to turn off important ones
like warnings for overwriting blocks. These warnings are especially crucial if you are working
on real machinery. If more then one person is using the software then you can reset these
messages to display again by going to the SIMATIC Manager and select the menu Options |
Customize. Click the General tab and press the Activate button. If its grayed out then all
messages are set to display.
S7 Library Functions
S7 Library Functions
I couldn't find a complete listing of all the function blocks in the standard Siemens S7 Libraries
so I made one myself. It helps me get a better overview of what is available. The complete
listing is also available as an Excel spreadsheet so you can sort or adjust to your needs.
Family
Description
SFB 0
CTU
IEC_TC
Count Up
SFB 1
CTD
IEC_TC
Count Down
SFB 2
CTUD
IEC_TC
Count Up/Down
SFB 3
TP
IEC_TC
Generate a Pulse
SFB 4
TON
IEC_TC
Generate an On Delay
SFB 5
TOF
IEC_TC
SFB 8
USEND
SFB 9
URCV
SFB 12
BSEND
SFB 13
BRCV
SFB 14
GET
SFB 15
PUT
SFB 16
SFB 19
START
SFB 20
STOP
SFB 21
RESUME
SFB 22
STATUS
SFB 23
USTATUS
SFB 29
SFB 30
SFB 31
SFB 32
DRUM
TIMERS
SFB 33
ALARM
SFB 34
ALARM_8
Implement a Sequencer
S7 Library Functions
Signals
SFB 35
ALARM_8P
SFB 36
NOTIFY
SFB 37
AR_SEND
SFB 38
HSC_A_B
SFB 39
POS
ICONT
SFB 41
CONT_C
ICONT
SFB 42
CONT_S
ICONT
SFB 43
PULSEGEN
ICONT
SFB 44
ANALOG
TEC_FUNC
SFB 46
DIGITAL
TEC_FUNC
SFB 47
COUNT
TEC_FUNC
SFB 48
FREQUENC TEC_FUNC
SFB 49
PULSE
TEC_FUNC
SFB 52
RDREC
DP
SFB 53
WRREC
DP
SFB 54
RALRM
DP
Receiving an Interrupt
SFB 60
SEND_PTP
TEC_FUNC
SFB 61
RECV_PTP
TEC_FUNC
SFB 62
RES_RECV
TEC_FUNC
SFB 63
SEND_RK
TEC_FUNC
SFB 64
FETCH_RK
TEC_FUNC
SFB 65
SERVE_RK
TEC_FUNC
SFB 75
SALRM
DP
SFB 81
RD_DPAR
IO_FUNCT
S7 Library Functions
Number Name
Family
Description
SFC 0
SET_CLK
CLK_FUNC
SFC 1
READ_CLK
CLK_FUNC
SFC 2
SET_RTM
CLK_FUNC
SFC 3
CTRL_RTM
CLK_FUNC
SFC 4
READ_RTM
CLK_FUNC
SFC 5
GADR_LGC
IO_FUNCT
SFC 6
RD_SINFO
SFC 7
DP_PRAL
DP
SFC 9
EN_MSG
SFC 10
DIS_MSG
SFC 11
DPSYC_FR
DP
SFC 12
D_ACT_DP
DP
SFC 13
DPNRM_DG DIAGNSTC
SFC 14
DPRD_DAT
DP
SFC 15
DPWR_DAT DP
SFC 17
ALARM_SQ
SFC 18
ALARM_S
SFC 19
ALARM_SC
SFC 20
BLKMOV
MOVE
Copy Variables
SFC 21
FILL
MOVE
SFC 22
CREAT_DB
SFC 23
DEL_DB
SFC 24
TEST_DB
SFC 25
COMPRESS
SFC 26
UPDAT_PI
IO_FUNCT
SFC 27
UPDAT_PO
IO_FUNCT
SFC 28
SET_TINT
SFC 29
CAN_TINT
SFC 30
ACT_TINT
SFC 31
QRY_TINT
SFC 32
SRT_DINT
S7 Library Functions
SFC 33
CAN_DINT
SFC 34
QRY_DINT
SFC 35
MP_ALM
SFC 36
MSK_FLT
DIAGNSTC
SFC 37
DMSK_FLT
DIAGNSTC
SFC 38
READ_ERR
DIAGNSTC
SFC 39
DIS_IRT
IRT_FUNC
SFC 40
EN_IRT
IRT_FUNC
SFC 41
DIS_AIRT
IRT_FUNC
SFC 42
EN_AIRT
IRT_FUNC
SFC 43
RE_TRIGR
SFC 44
REPL_VAL
DIAGNSTC
SFC 46
STP
SFC 47
WAIT
SFC 48
SNC_RTCB
CLK_FUNC
SFC 49
LGC_GADR
IO_FUNCT
SFC 50
RD_LGADR
IO_FUNCT
SFC 51
RDSYSST
DIAGNSTC
SFC 52
WR_USMSG DIAGNSTC
SFC 54
RD_PARM
IO_FUNCT
SFC 55
WR_PARM
IO_FUNCT
SFC 56
WR_DPARM IO_FUNCT
SFC 57
PARM_MOD IO_FUNCT
SFC 58
WR_REC
IO_FUNCT
SFC 59
RD_REC
IO_FUNCT
SFC 60
GD_SND
SFC 61
GD_RCV
SFC 62
CONTROL
SFC 63
AB_CALL
PLASTICS
SFC 64
TIME_TCK
CLK_FUNC
SFC 65
X_SEND
SFC 66
X_RCV
S7 Library Functions
Local S7 Station
SFC 67
X_GET
SFC 68
X_PUT
SFC 69
X_ABORT
SFC 70
GEO_LOG
IO_FUNCT
SFC 71
LOG_GEO
IO_FUNCT
SFC 72
I_GET
SFC 73
I_PUT
SFC 74
I_ABORT
SFC 78
OB_RT
DIAGNSTC
SFC 79
SET
BIT_LOGC
SFC 80
RSET
BIT_LOGC
SFC 81
UBLKMOV
MOVE
SFC 82
CREA_DBL
DB_CTRL
SFC 83
READ_DBL
DB_CTRL
SFC 84
WRIT_DBL
DB_CTRL
SFC 85
CREA_DB
SFC 87
C_DIAG
SFC 90
H_CTRL
HF_FUNCT
SFC 100
SET_CLKS
CLK_FUNC
SFC 101
RTM
CLK_FUNC
SFC 102
RD_DPARA
IO_FUNCT
Redefined Parameters
SFC 103
DP_TOPOL
DP
SFC 104
CIR
SFC 105
READ_SI
SFC 106
DEL_SI
SFC 107
SFC 108
ALARM_D
SFC 112
PN_IN
PROFIne2
S7 Library Functions
SFC 113
PN_OUT
PROFIne2
SFC 114
PN_DP
PROFIne2
Update DP interconnections
SFC 126
SYNC_PI
IO_FUNCT
SFC 127
SYNC_PO
IO_FUNCT
Family
Description
FC 61
GP_FPGP
FC 62
GP_GPFP
FC 63
GP_ADD
FC 64
GP_SUB
FC 65
GP_MUL
FC 66
GP_DIV
FC 67
GP_VGL
FC 68
RAD_GP
FC 69
MLD_TG
FC 70
MLD_TGZ
FC 71
MLD_EZW
FC 72
MLD_EDW
FC 73
FC 74
MLD_SAM
FC 75
MLD_EZ
FC 78
FC 79
MLD_EZK
FC 80
MLD_EDK
S5_CNVRT Message
of first value with double flashing light, bitwise, A+M
FC 81
COD_B4
FC 82
COD_16
FC 83
MUL_16
FC 84
DIV_16
S7 Library Functions
FC 85
ADD_32
FC 86
SUB_32
FC 87
MUL_32
FC 88
DIV_32
FC 89
RAD_16
FC 90
REG_SCHB
FC 91
FC 92
REG_FIFO
FC 93
REG_LIFO
FC 94
DB_COPY1
FC 95
DB_COPY2
FC 96
RETTEN
FC 97
LADEN
FC 98
COD_B8
FC 99
COD_32
FC 100
AE_460_1
FC 101
AE_460_2
FC 102
AE_463_1
FC 103
AE_463_2
FC 104
AE_464_1
FC 105
AE_464_2
FC 106
AE_466_1
FC 107
AE_466_2
FC 108
RLG_AA1
FC 109
RLG_AA2
FC 110
PER_ET1
FC 111
PER_ET2
FC 112
SINUS
FC 113
COSINUS
FC 114
TANGENS
FC 115
COTANG
FC 116
ARCSIN
FC 117
ARCCOS
S7 Library Functions
FC 118
ARCTAN
FC 119
ARCCOT
FC 120
LN_X
FC 121
LG_X
FC 122
B_LOG_X
FC 123
E_H_N
FC 124
ZEHN_H_N
FC 125
A2_H_A1
Family Description
FC 1
AD_DT_TM IEC
FC 2
CONCAT
FC 3
D_TOD_DT IEC
FC 4
DELETE
IEC
FC 5
DI_STRNG
IEC
FC 6
DT_DATE
IEC
FC 7
DT_DAY
IEC
FC 8
DT_TOD
IEC
FC 9
EQ_DT
IEC
FC 10
EQ_STRNG IEC
FC 11
FIND
IEC
FC 12
GE_DT
IEC
FC 13
GE_STRNG IEC
FC 14
GT_DT
FC 15
GT_STRNG IEC
FC 16
I_STRNG
IEC
FC 17
INSERT
IEC
FC 18
LE_DT
IEC
FC 19
LE_STRNG
IEC
FC 20
LEFT
IEC
FC 21
LEN
IEC
FC 22
LIMIT
IEC
FC 23
LT_DT
IEC
IEC
IEC
S7 Library Functions
FC 24
LT_STRNG
IEC
FC 25
MAX
IEC
FC 26
MID
IEC
FC 27
MIN
IEC
FC 28
NE_DT
IEC
FC 29
NE_STRNG IEC
FC 30
R_STRNG
IEC
FC 31
REPLACE
IEC
FC 32
RIGHT
IEC
FC 33
S5TI_TIM
IEC
FC 34
SB_DT_DT IEC
FC 35
SB_DT_TM IEC
FC 36
SEL
IEC
FC 37
STRNG_DI
IEC
FC 38
STRNG_I
IEC
FC 39
STRNG_R
IEC
FC 40
TIM_S5TI
IEC
Family
Description
FB 41
CONT_C
ICONT
Continuous Control
FB 42
CONT_S
ICONT
Step Control
FB 43
PULSEGEN ICONT
FB 58
FB 59
TCONT_S
Pulse Generation
Communication Blocks
Number Name
Family
Description
FB 2
IDENTIFY
CP_300
FB 3
READ
CP_300
FB 4
REPORT
CP_300
FB 5
STATUS
CP_300
S7 Library Functions
WRITE
CP_300
FB 8
USEND
CP_300
FB 9
URCV
CP_300
FB 12
BSEND
CP_300
FB 13
BRCV
CP_300
FB 14
GET
CP_300
FB 15
PUT
CP_300
FB 20
GETIO
FB 21
SETIO
FB 22
GETIO_PART
FB 23
SETIO_PART
FB 55
IP_CONFIG
CP_300
FB 63
TSEND
COMM
FB 64
TRCV
COMM
FB 65
TCON
COMM
FB 66
TDISCON
COMM
FB 67
TUSEND
COMM
FB 68
TURCV
COMM
FC 1
DP_SEND
CP_300
FC 2
DP_RECV
CP_300
FC 3
DP_DIAG
CP_300
FC 4
DP_CTRL
CP_300
FC 5
AG_SEND
CP_300
FC 6
AG_RECV
CP_300
FC 7
AG_LOCK
CP_300
FC 8
AG_UNLOCK
CP_300
S7 Library Functions
AG_CNTRL
CP_300
FC 11
PNIO_SEND
CP_300
FC 12
PNIO_RECV
CP_300
FC 40
FTP_CONNECT CP_300
FC 41
FTP_STORE
FC 42
FTP_RETRIEVE CP_300
FC 43
FTP_DELETE
CP_300
FC 44
FTP_QUIT
CP_300
FC 50
AG_LSEND
CP_300
FC 60
AG_LRECV
CP_300
FC 62
C_CNTRL
CP_300
CP_300
Family
Description
FB 80
FB 81
DCAT
TIMERS
FB 82
MCAT
TIMERS
FB 83
IMC
FB 84
SMC
FB 85
DRUM
TIMERS
FB 86
PACK
MOVE
Pack Data
FC 80
TONR
TIMERS
FC 81
IBLKMOV
MOVE
FC 82
RSET
FC 83
SET
FC 84
ATT
TABLE
Add to Table
FC 85
FIFO
TABLE
FC 86
TBL_FIND TABLE
Table Find
FC 87
LIFO
TABLE
S7 Library Functions
FC 88
TBL
TABLE
FC 89
TBL_WRD TABLE
FC 90
WSR
FC 91
WRD_TBL TABLE
Word to Table
FC 92
SHRB
SHIFT
FC 93
SEG
FC 94
ATH
FC 95
HTA
FC 96
ENCO
FC 97
DECO
FC 98
BCDCPL
FC 99
BITSUM
FC 100
RSETI
FC 101
SETI
FC 102
DEV
MATH_FP
Standard Deviation
FC 103
CDT
TABLE
FC 104
TBL_TBL
TABLE
Table to Table
FC 105
SCALE
FC 106
UNSCALE
SHIFT
Table
Miscellaneous Blocks
Number Name
Family
Description
FB 60
SET_SW
FB 61
FB 62
FC 60
LOC_TIME TIMEFUNC reads the time status or time of the CPU and calculates the
local time. It is therefore only useful on CPUs with time
status.
FC 61
BT_LT
TIMEFUNC calculates the local time from the base time given at the
input.
FC 62
LT_BT
TIMEFUNC calculates the base time from the local time given at the
S7 Library Functions
input.
FC 63
S_LTINT
TIMEFUNC sets the required time interrupt to the preset time. This
time is given in local time.
Term
Description
Explanation
C7
CFC
Continuous Function
Chart
CP
Communication
Processor
DB
Data Block
FB
Function Block
FBD
FC
Function Call
FM
Function Module
GSD
Generic Station
Description
HiGraph
IM
Interface Module
LAD
M7
Programmable modules
MMC
MPI
OB
Organization Block
OP
Operator Panel
PCS
PG
Programming Terminal
PPI
Profibus
DP
Profibus Decentral
Peripherals
Profibus
PA
Profibus Process
Automation
S7
Structured Control
http://www.plcdev.com/book/export/html/375[14/12/2015 09:21:47 p.m.]
SCL
Language
SFB
SFC
SM
Signal Module
STL
Statement List
TP
Touch Panel
UDT
User-Definded Data
Type
VAT
Example in STL
BOOL (Bit)
1 Boolean
text
TRUE/FALSE
TRUE
BYTE (Byte)
WORD
(Word)
DWORD
(Double
word)
16 Binary
number
2#0 to
2#1111_1111_1111_1111
L B#16#10
L byte#16#10
L 2#0001_0000_0000_0000
L W#16#1000
L word#16#1000
BCD
C#0 to C#999
L C#998
Decimal
number
unsigned
B#(0,0) to B#(255,255)
L B#(10,20)
L byte#(10,20)
32 Binary
number
2#0 to
2#1111_1111_1111_1111_
1111_1111_1111_1111
Hexadecimal W#16#0000_0000 to
number
W#16#FFFF_FFFF
Decimal
number
unsigned
L 2#1000_0001_0001_1000_
1011_1011_0111_1111
L DW#16#00A2_1234
L dword#16#00A2_1234
B#(0,0,0,0) to
B#(255,255,255,255)
INT
(Integer)
16 Decimal
number
signed
-32768 to 32767
L 101
DINT
(Double
integer)
32 Decimal
number
signed
L#-2147483648 to
L#2147483647
L L#101
REAL
(Floatingpoint
number)
32 IEEE
Floatingpoint
number
L 1.234567e+13
S5TIME
(SIMATIC
time)
16 S7 time in
steps of
10ms
(default)
S5T#0H_0M_0S_10MS to
S5T#2H_46M_30S_0MS and
S5T#0H_0M_0S_0MS
L S5T#0H_1M_0S_0MS
L
S5TIME#0H_1H_1M_0S_0MS
TIME (IEC
time)
32 IEC time in
steps of 1
ms, integer
signed
T#24D_20H_31M_23S_648MS L T#0D_1H_1M_0S_0MS
L TIME#0D_1H_1M_0S_0MS
to
T#24D_20H_31M_23S_647MS
DATE (IEC
date)
16 IEC date in
steps of 1
day
D#1990-1-1 to
D#2168-12-31
L D#1996-3-15
L DATE#1996-3-15
TIME
_OF_DAY
(Time)
32 Time in
steps of 1
ms
TOD#0:0:0.0 to
TOD#23:59:59.999
L TOD#1:10:3.3
L TIME_OF_DAY#1:10:3.3
L 'E'
CHAR
(Character)
8 ASCII
characters
S5TIME NOTES
Underscores in time and date are optional
It is not required to specify all time units (for example: T#5h10s is valid)
Maximum time value = 9,990 seconds or 2H_46M_30S
S5TIME Format
00
100 ms
01
1s
10
10 s
11
Data Type
Address
Range
I/O Signals
I
Input bit
BOOL
0 to
65535.7
IB
EB
Input byte
BYTE, CHAR
0 to 65535
IW
EW
Input word
0 to 65534
ID
ED
0 to 65532
Output bit
BOOL
0 to
65535.7
QB
AB
Output byte
BYTE, CHAR
0 to 65535
QW
AW
Output word
0 to 65534
QD
AD
0 to 65532
Marker Memory
M
Memory bit
BOOL
0 to
65535.7
MB
MB
Memory byte
BYTE, CHAR
0 to 65535
MW
MW
Memory word
0 to 65534
MD
MD
0 to 65532
Peripheral I/O
PIB
PEB
BYTE, CHAR
0 to 65535
PIW
PEW
0 to 65534
PID
PED
0 to 65532
PQB
PAB
BYTE, CHAR
0 to 65535
PQW
PAW
0 to 65534
PQD
PAD
Peripheral output
0 to 65532
double word
TOD, TIME
Timer
TIMER
0 to 65535
Counter
COUNTER
0 to 65535
FB
FB
Function block
FB
0 to 65535
OB
OB
Organization block
OB
1 to 65535
FC
FC
Function
FC
0 to 65535
SFB
SFB
SFB
0 to 65535
SFC
SFC
System function
SFC
0 to 65535
DB
Data block
1 to 65535
UDT
0 to 65535
Logic Blocks
Data Blocks
DB
UDT
Introduction
The most common form of addressing used in the Siemens S7 PLCs is direct and symbolic.
When a direct addressed is referenced by an instruction there is no question as to the location
in memory. The following are examples of direct addressing:
Inputs:
Outputs:
Markers:
Timers:
T34
Counters:
C23
Local:
Data Block:
By using the methods of indirect addressing the address used by an instruction can be varied to
point to any number of locations. In this case, a memory location stores a pointer to
another memory location. While this may increase the difficulty of troubleshooting, its
advantage is to greatly reduce the number of networks and instructions needed to control a
process. It is also a method that must be understood to use some of the library and system
function calls provided by Siemens.
A POINTER data type is used to format a number to be accepted as an address rather then a
value. A pointer is always preceded by a P# symbol. The pointer address may be in three
different formats.
Format
Example
Memory Storage
P#<byte>.<bit>
P#8.0
P#124.3
4 Bytes
P#<area><byte>.<bit>
P#M50.0
P#I4.0
6 Bytes
10 Bytes
The ANY data type is used to pass a parameter of an unknown or undefined data type. Some
functions in the library use the ANY data type to work on whole sections of memory. To do
this, the last pointer method is used to describe an area. For example the address P#DB25.DBX
0.0 Byte 14 points to the first byte of DB25 with a length of 14 bytes.
NOTE: A DINT can be converted to a POINTER by simply shifting the double word left by 3 bits.
DB
10
DBW
36
MW
22
OPN
DI
20
DIB
12
DBB
37
When monitoring in STL the shared DB number is displayed in the DB1 column and the
instance DB number is displayed in the DB2 column.
Furthermore, there are instructions to confirm that the correct DB number is opened and that it
is large enough for the next operation.
DBNO
DBLG
DINO
DILG
MW
T [MW 2]
OPN
DB [#DB_Temp]
The memory area identifiers I, Q, M, L, DB use a double word (32-bit) location using the
POINTER data type.
L
P#0.7
MD
I [MD 2]
M [MD 2]
OPN
DB
P#2.0
#TempPointer
DBW [#TempPointer]
>D
//Open DB5
When monitoring memory indirect addressing the INDIRECT column displays the current
address the instruction is using.
http://www.plcdev.com/book/export/html/624[14/12/2015 09:24:38 p.m.]
Note that math can be done on the POINTER data type using the double math instructions
(e.g. P#2.0 + P#5.0 = P#7.0).
L
P#2.0
P#5.0
+D
MD
Since the bit position only goes to eight the result of P#8.7 + P#1.1 = P#10.0 and not P#9.8.
These methods can be used to offset the address or increase/decrease the pointer in a loop.
Description
LAR1
LAR1 AR2
TAR1
TAR1 MD28
TAR1 AR2
CAR
Addition can be directly accomplished on AR1 and AR2 with the following:
STL
Description
+AR1
Adds the contents of ACCU1 to AR1 and stores the result back into
AR1
+AR1 P#100.0
Adds the pointer constant to AR1 and stores the result back into AR1
P#0.7
LAR1
I [AR1, P#0.0]
Q [AR1, P#1.1]
P#I0.7
LAR1
P#Q124.0
LAR2
[AR1, P#0.0]
[AR2, P#1.1]
This next example shows area-crossing methods using a word and double word format.
L
P#M0.0
LAR1
W [AR1,
P#10.0]
OPN
DB
P#DBX 0.0
LAR2
L#0
D [AR2,
P#50.0]
//Open DB5
Exercise #1
1. Comment the lines of STL below to describe what this network does:
0.0
JC
M001
P#M10.0
JU
M002
M001:
P#Q0.0
M002:
LAR1
[AR1, P#0.1]
0.1
Exercise #2 (Advanced)
1. Create a DB with an array of 10 real numbers. Populate the array with random values.
2. Create a function that will return the max number in the array and its position. Use the
indirect addressing method of your choice.
BR
CC0
CC1
OV
OS
OR
STA
RLO
/FC
Each instruction may do the following to each bit in the status word.
-
No read or write
Read
Reset to "0"
Set to "1"
The status word can be seen by displaying the STATUS column while monitoring in STL view.
The RLO (bit 1) and the STA (bit 2) are also displayed in the RLO and STA column.
2. On the second line, the /FC bit is now 1 indicating that this line needs to use the RLO
from the previous line. The address I1.1 is on so the STA = 1. The RLO from the last
line is 1 and this is anded with the current STA with a result of 1 in the current
RLO.
3. The same thing happens on the second line but this time 1 and 0 makes the current RLO
= 0.
4. The fourth is the Assign instruction which takes the RLO and writes it out to the
corresponding address. In this case the final RLO = 0 so the output will be off. If
M0.0 was 1 then the And operation will evaluate to true making the RLO = 1 which
will then turn on the output Q1.0.
ACCU2 = ACCU1
Result = 0
Result < 0
Result > 0
Gradual underflow
Result = 0
Result <> 0