Modifying logic of application

Modifying the ST-code

The ST-object program already contains a sample application for a counter. The existing application is enhanced just a bit during this step.

  1. In the ST-object program, search for the declaration of the →variable up.
    It is this line: up : BOOL;

  2. Enhance the declaration by the →initial value TRUE.
    Mind that the icon images/download/attachments/405733678/IconError-version-1-modificationdate-1529909643654-api-v2.png is shown on the left edge while your are entering the code. This indicates a faulty term in the ST-code.
    Example for errors in the ST-Code:
    images/download/attachments/405733572/CounterError-version-1-modificationdate-1529909220568-api-v2.png
    If you are not too familiar with the ST-syntax, use the content assist of logi.CAD 3: context menu within ST-editor, Content Assist – Double-click an element in the list.
    images/download/attachments/405733567/CounterAssist-version-1-modificationdate-1529909174139-api-v2.png
    Here the error-free ST-code for the declared variable with the initial value TRUE:
    images/download/attachments/405733560/CounterOK-version-1-modificationdate-1529909080684-api-v2.png

  3. Save the ST-code: menu File, command Save

Modifying the FBD-logic

The FBD-object Counter already contains a sample application for a counter. The existing application is enhanced just a bit during this step.

  1. In the FBD-editor press Ctrl+L in order to display the list of the declared variables.

  2. Search for the declaration of the variable up.

  3. Enhance the declaration by the initial value TRUE: Double-click into the column Initial value for the variable, enter TRUE and press the Enter-key.
    This illustration shows how the initial value for the variable up is being modified:

    images/download/attachments/405733553/CounterFBD_EN-version-1-modificationdate-1529909004263-api-v2.png
  4. Save the FBD-logic: menu File, command Save