V-, M- and L-memory for S7-200

mulderm

Member
Join Date
Jun 2003
Location
Netherlands
Posts
298
Hello,

I programming Step7 Microwin for S7-200 plc´s.
What are the difference between V-,L- and M-memory and what will be the best option?

Greetings,

mulderm
 
Hello Mulderm;

From the best source I know, the manual S7-200_e.pdf:

Accessing Data in the Memory Areas

Variable Memory Area: V

You can use V memory to store intermediate results of operations being performed by the control logic in your program. You can also use V memory to store other data pertaining to your process or task. You can access the V memory area in bits, bytes, words, or double words:

Bit: V
[byte address].[bit address] V10.2

Byte, Word, or Double Word: V
[size][starting byte address] VW100



Bit Memory Area: M

You can use the bit memory area (M memory) as control relays to store the intermediate status of an operation or other control information. You can access the bit memory area in bits, bytes, words, or double words:

Bit: M
[byte address].[bit address] M26.7

Byte, Word, or Double Word: M
[size][starting byte address] MD20



Local Memory Area: L

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.

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.


Hope this helps,
Daniel Chartier
 
There is a lot more V memory than M. So generally you will use M memory for bits and V memory for all other variables. It isn't a rule but it makes reading the programme more logical. You have M0.0 to M31.7 available which is 32 bytes and depending on the PLC version from 4096 to 24576bytes of V memory. Unlike some PLCs the V memory isn't limited to the data types it can hold, you can put any type of data in to it, but it is up to you to make sure you don't write a Real and then read it as a Double Int. Or any other combination that will give you bad data.
 
Don't quote me on this, it is from long term memory. The S7-200 range wasn't originally developed by Siemens, it was a Texas Instruments device, that part of Texas Instruments were then bought by Siemens.
 

Similar Topics

I have a product that uses a Siemens Simatic s7-1200 PLC. My company did not write the PLC program, but we have the program on an SD card. We...
Replies
5
Views
2,208
What type of internal memory does the MicroLogix 1200 Ver.C have? In the documentation, there is only an internal non-removable battery for the...
Replies
1
Views
1,554
Hi Guys, Is there any way of compressing the "Work Memory" of a Siemens S7 1200 CPU. I did change the installed card from a 4mb to a 12mb. I...
Replies
16
Views
8,896
Hello! I am using S7-1200 PLC 1212C AC/DC with configured Modbus TCP Server. I can already read/write Inputs/Outputs (Coils) and Memory Words...
Replies
7
Views
2,863
Hi we currently have a Micrologic 1200 running an automated saw program. If I plug in a memory module will it automatically write the program to...
Replies
1
Views
1,273
Back
Top Bottom