You can add an LD algorithm to a basic FB type with the New item of the popup menu of the basic FB type's ECC (Execution Control Chart).
Clicking on the algorithm name in the Navigation tree will cause the LD algorithm to appear in the Workspace area as illustrated below. You can then edit the algorithm rung-by-rung as described in the next section.
You can add a rung to the LD by clicking the New Rung item of the Workspace popup menu. The rung dialog will open so you can edit the new rung.
You can move a rung up or down in the LD (when possible) with the Move Up or Move Down items of the rung's popup menu, respectively.
You can delete a rung from the LD with the Delete item of the rung's popup menu. A dialog box will pop up to make sure you really want to delete the rung.
This dialog appears when you click the New Rung item of the Workspace popup menu or when you double-click on an existing rung or click on the Edit item of its popup menu.
The output of the rung can be selected from a drop-down list of the Boolean outputs and internal variables of the function block type, and the expression whose value is to be assigned to the output can be entered using a simplified reverse Polish notation. This notation is translated into infix notation for display in the text area as illustrated above.
Since the FBD and ST languages are available for the specification of complex algorithms, IEC 61499-2 recommends that the use of the LD language be limited to rungs performing the evaluation of assignment statements of the form:
|<output> := <expression>|
For portability between software tools, IEC 61499-2 recommends that the XML Expression element have the following simple postfix-operator textual syntax with whitespace-separated terms:
|expression ::= and_expression|
| and_expression and_expression '&'
| or_expression or_expression '|'