Simatic Step 7

T

Thread Starter

Toni

Hi, i've just learn to program in LAD a few months back and now ive some questions to asks:

1. how to implement a pointer to a data block. If in the data block, it consist of an array how do i use a pointer to increment the index of the array.

2.Also (without using pointer) when i have an array in my data blcok, how do i increment the index after each loop? Do i have to use a counter which output to a memory word (eg MW1) and use that memory word as an index. EG.
arr[MW1].

3.Right now im programming all my codes into 1 FC which i think is no good. So when i divide them into different FCs, how do i pass informations btw each FCS? For instance do i activate all FCs in my OB1 and just use gobal variables? Or is it better to activate and deactivate each FCs base on conditions?
eg.
1st call to Input Station block
2nd if sensor detects incoming workpiece, call to Transporter block.
3rd If transporter has pick up the workpiece, deactivates Input Station block.
4th Call to Input station block if transporter has release the workpiece at the testing station.
blah blah...

Which one is better?

That's all i have to ask
Thank you everyone

regards
Toni
 
Hi Toni,

1) I don't think it is good to implement indirect addressing when programing in LAD. STL will be better and easier.

2) Please, read in S7 help about it. It isn't difficult but not quite easy to explain without example.

3) You are right. It isn't a good idea to program whole program code in one FC (you can program it in OB1 too, but!!!???). You can divide the code into different FCs, FBs and of course networks (inside blocks) as you want. There is no rule for it. The important is that you understant yours code and are able to localise a problem/bug.

I can send you some code example if you want it.
My address: [email protected]

Pavel
 
Top