S7-200 Library creation problem

resonanceshah

Member
Join Date
Mar 2007
Location
mah
Posts
1
Hi guys,

I have a problem related to the Siemens S7-200 PLC. To be able to perform a particular position control for 2 separate motors, I decided to develop a library for the same. I developed a program (for position control) purely with local variables and specified each variable as an IN, OUT or a TEMP. I created 2 subroutines (say A & B) within 1 program (say XYZ) and created a library.

Now I open the main project where i intend using this library. So I add library XYZ and use A & B sub-libraries within for position control of 2 motors.

The problem is that both the motors run perfect individually . But the minute i decide to run both together, the motors start behaving erractically. Their sequence seems to make no sense at all and i get a feeling that somehow the local variables (used within the library) are getting random values. This makes me think whether I am missing out on something about how the S7-200 accesses local memory.

Also, the library has been created such that no local memory value is assumed when the library is entered. Every time the library is accessed by main program, based on the Inputs assigned to library, the outputs will be generated.

My understanding of the local memory access is as follows.

- Every subroutine created will have 60 bytes of local memory allocated to it.
- There is no guarantee of the value in the local memory once I am out of the routine.
- No routine can access local memory of another routine.

I would really appreciate help of any kind.

Thanks
 
You should "initialise" local memory before using it.
Can you post your project?

From the S7 200 help file
Because local variables use temporary memory, be sure that you initialize your local variables within the POU each time the POU is called. You cannot be sure that the local variable will retain a data value from one iteration to the next.
 
Last edited:

Similar Topics

Anyone have or would mind sharing the above? I went to the oscat website (and I have a login) But I need to learn german :) Thanks
Replies
3
Views
3,075
Hi, it is normal behaviour,when I uploaded program from s7-200 cpu and there is no requirement for v memory even if there is a lot of USS library...
Replies
0
Views
1,422
Not sure quite how to ask what i need an answer to without getting confusing! Basically i am creating some libraries I want when these libraries...
Replies
0
Views
6,224
Not sure quite how to ask what i need an answer to without getting confusing! Basically i am creating some libraries I want when these...
Replies
0
Views
4,974
Where can I find it ? I would like to avoid writing program myself. I need only basic functions - read/write holding registers.
Replies
1
Views
10,068
Back
Top Bottom