Peter Nachtwey
Member
Siemen's LD implementation is crippled.
It isn't fair to say that Siemen's version of LD respresent all implementation of LD. The Siemens LD implentation is a kludge that must have been added for the North American market.
It is obvious that the S7 is designed to run STL and anything else is just an after thought. Just compare the STL generated from LD with the text required to enter a Rockwell rung. When entering ladder using text on a Rockwell rung there is no need to keep track of a BR register.
The brackets are a common feature of many languages like basic, C, fortran etc. The ( cause the current value to be pushed on a stack. This is very similar to the Automation Directs PUSH instruction. The ) cause the value on the stack to be popped off the stack and used as an operand.
Note the AB NXB instruction also pushes the current state on the stack. The BND instruction causes the save results to be popped off the stack and 'OR'ed together.
STL is more efficient than ladder because the intermediate results don't need to be stored and reloaded between rungs. However, I wonder if Rockwell's ladder code is so optimized that it would minimize reloading parameters that have already been loaded in that rung. I know that is the way I would do it.
It isn't fair to say that Siemen's version of LD respresent all implementation of LD. The Siemens LD implentation is a kludge that must have been added for the North American market.
It is obvious that the S7 is designed to run STL and anything else is just an after thought. Just compare the STL generated from LD with the text required to enter a Rockwell rung. When entering ladder using text on a Rockwell rung there is no need to keep track of a BR register.
This is shear stupidity. Ask the engineer to do indirect addressing in LD.Its a shame that unknowledgible endineers sometimes enforce rules where STL is not allowed at all, I can understand having the basic code in ladder but sub-routine functions are far better in STL.
The brackets are a common feature of many languages like basic, C, fortran etc. The ( cause the current value to be pushed on a stack. This is very similar to the Automation Directs PUSH instruction. The ) cause the value on the stack to be popped off the stack and used as an operand.
Note the AB NXB instruction also pushes the current state on the stack. The BND instruction causes the save results to be popped off the stack and 'OR'ed together.
STL is more efficient than ladder because the intermediate results don't need to be stored and reloaded between rungs. However, I wonder if Rockwell's ladder code is so optimized that it would minimize reloading parameters that have already been loaded in that rung. I know that is the way I would do it.