S7 Local data

barryoc

Lifetime Supporting Member
Join Date
Nov 2009
Location
Kilkenny
Posts
148
Hi everyone,

I'm in the process of (learning) tiding up an s7 project and came accross a small problem. In the attached image is a flip flop for 32 panel buttons. To tidy up the program i was intending on changing MD's to LD's. After i done this 3 buttons on my screen stopped working. Can anyone offer an explanation for this.

The button that stopped working are
input db1.dbx0.5 Output db1.dbx8.5
input db1.dbx1.4 Output db1.dbx9.4
input db1,dbx2.1 Output db1.dbx10.1

Regards,
Barry

Flip Flop.jpg
 
Create named dw variables in the temp area and use those. Your post does not show what writes to MD2 for example.
Copy the relevant blocks to a library and post the zipped project.
 
They can hold their state. Its just that they usually get over written during the processing of the contents of OB1.

Case in point (all be it hopelessly simple)

// OB1
CALL FC 1
CALL FC 2
//FC1
A M 0.0
FP M 0.1
S L 0.0
//FC2
A L 0.0
= M 0.2

When m0.0 turns on then off m0.2 remains on
 
I have attached the whole project in case i forgot a relevant block. Nothing writes to MD 2, 6, or 10 only the code in fc71 for the flip flop. Many thanks for all your help.

Regards,
Barry
 
Nothing else writes to MD2, MD6 or MD10.
But there will be a lot of writes to LD2, LD6 and LD10 from many other places in your program.
Basically you should not exchange MDs for LDs.
 
If you are using GoToLocation to verify what writes to MD2 etc, always check the overlapping access option - better still, look in the xref for m flag usage. As you can see the bits that make up MD6 etc. are being written from elsewhere.

fff.JPG
 
Many thanks for the help. I thought it might have been a good way to tidy up some blocks.

PS MD10 MD14 and MD18 were the original mds. I changed them to md2 etc when LD would not work for me.

Regards,
Barry
 

Similar Topics

Siemens S7-300 Hello! i'm new in PLC and have some questions. 1 question. How i can read this: L DW#16#84000000 Decimal number unsigned...
Replies
5
Views
1,844
Hi all, I am trying to read the opc data's of 5000 Code from a remote plc to a local plc. In that local PC rslinx enterprise was installed , in...
Replies
0
Views
2,828
Hi I have the attached code and am testing it using PLC SIM. The PLC goes to STOP mode with an "Error when allocating local data", requested...
Replies
6
Views
3,962
This may sound academic, but just for the sake of my understanding, I would like to copy the fixed part of local variables in for instance...
Replies
2
Views
1,634
Hi I've just been analysing a crash on an S7-414, which was caused by the error "Error when allocating local data" Looking at the Stack...
Replies
5
Views
3,277
Back
Top Bottom