Listen carefully to what LD says, his advice is always good. Avoid addressing anything absolutely if at all posible and especially avoid addressing temp data absolutely; you will only regret it some time in the future and cause yourself more headaches.
My current project has 60 drives on profibus and 58 remote operator stations on profinet, if I referred to everything absolutely, I'd still be writing code at Christmas and it would be full of bugs.
Nick
Nick, I appreciate your concern, however..........
If I avoided addressing anything absolutely,as you suggest, I would never be able to increment an address mathmatically at runtime.
What is "RED" + 5 seconds?
Is "Sensor Number Three" greater than 12?
I am glad it works for you, but there are situations where symbolic addressing fails.
Quick, give me 12 variables in STAT and name them all with symbols before you write the program in the FB. Or I can just name the stuff that needs naming, and leave everything else as STAT_N.....
I know I could spend 2 hours giving everything I do a name and make sure they are all unique......but that's not always necessary or desirable. frequnetly, MW24 is enough. "I need to drop this array of bools into a memory location and put it through a word compare, what word is available? MW24......done".but whats the name?????? who cares, next.
Not everything has or needs to have a symbol of significance.
Now use BLKMOV SFC20 with symbols, now use the same network to move the same area of the next DB, at rubtime, with information from a calculation. Careful the symbols might be different. Now you need that "symbol math" block. Machine is in state 3, move DB3.DBX0.0 byte 20 to DB5.DBX20.0 byte 20........next time it might be state 6 goes to DB12, or even some condition changes the area from DBX20 to 40.
Don't get hung up on any one way to do things.
Some people think everything should be a symbol and you shouldn't even use the marker memory to avoid data type errors.
Do you use marker memory? Be careful, it might cause a conflict of data type.
S7 is full of exceptions and gotchas. I am just trying to make it work. If the simple way is to direct address something and it works, then so be it.
If it is better or simpler to use a db for memory areas, then I do that. If symbols are better, I do that. If a state machine is better for some process, I use one. If not, then event driven, or some other method.
Be flexible, and study the pros and cons of each method.
That was what this thread was about, if you read my first post......I see several ways to do this thing, I am exploring a possible new way, and in the process learning more about the environment I am using. Wether it works or not, it is a learning experience.
And never always do anything.