Siemens Simatic S7-200 System Manual page 40

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

Advertisement

S7-200 Programmable Controller System Manual
Special Memory: SM
The SM bits provide a means for communicating information between the CPU and your program. You
can use these bits to select and control some of the special functions of the S7-200 CPU, such as: a bit
that turns on for the first scan cycle, a bit that toggles at a fixed rate, or a bit that shows the status of math
or operational instructions. (For more information about the SM bits, see Appendix D.) You can access the
SM bits as bits, bytes, words, or double words:
Bit:
Byte, Word, or Double Word:
Local Memory Area: L
4
The S7-200 provides 64 bytes of local memory of which 60 can be used as scratchpad memory or for
passing formal parameters to subroutines.
Tip
If you are programming in either LAD or FBD, STEP 7–Micro/WIN reserves the last four bytes of local
memory for its own use. If you program in STL, all 64 bytes of L memory are accessible, but it is
recommended that you do not use the last four bytes of L memory.
Local memory is similar to V memory with one major exception. V memory has a global scope while L
memory has a local scope. The term global scope means that the same memory location can be
accessed from any program entity (main program, subroutines, or interrupt routines). The term local scope
means that the memory allocation is associated with a particular program entity. The S7-200 allocates
64 bytes of L memory for the main program, 64 bytes for each subroutine nesting level, and 64 bytes for
interrupt routines.
The allocation of L memory for the main program cannot be accessed from subroutines or from interrupt
routines. A subroutine cannot access the L memory allocation of the main program, an interrupt routine, or
another subroutine. Likewise, an interrupt routine cannot access the L memory allocation of the main
program or of a subroutine.
The allocation of L memory is made by the S7-200 on an as-needed basis. This means that while the
main portion of the program is being executed, the L memory allocations for subroutines and interrupt
routines do not exist. At the time that an interrupt occurs or a subroutine is called, local memory is
allocated as required. The new allocation of L memory might reuse the same L memory locations of a
different subroutine or interrupt routine.
The L memory is not initialized by the S7-200 at the time of allocation and might contain any value. When
you pass formal parameters in a subroutine call, the values of the parameters being passed are placed by
the S7-200 in the appropriate L memory locations of the called subroutine. L memory locations, which do
not receive a value as a result of the formal parameter passing step, will not be initialized and might
contain any value at the time of allocation.
Bit:
Byte, Word, or Double Word:
28
SM[byte address].[bit address]
SM[size][starting byte address]
L[byte address].[bit address]
L[size] [starting byte address]
SM0.1
SMB86
L0.0
LB33

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents