Skip to main content

Connecting the Elements to the Circuit

AND connection

The output signal returns TRUE when all input signals are TRUE. This kind of series circuit corresponds to a binary AND-connection.

  1. Drag a network to the editor.

    1. In the element bar, click the _c4ld_icon_toolbar_network.png symbol and drag the element to the insert position (rectangle) in the editor. Release the left mouse button.

      A new network will be inserted.

    2. Choose the title AND Gate for the network.

    3. Choose the comment Binary AND gate for the network.

    Tip

    The display of title and comment is controlled in the preferences. If these elements are not visible, then check if the corresponding option is disabled and enable it if necessary.

    For more information, see the following: Preferences command

  2. In the element bar, select a contact and drag it to the insert position in the network. Choose the name bInput_1 for the contact.

  3. In the element bar, select another contact. In the ladder diagram, click the insert position to the right of the bInput_1 contact. Choose the name bInput_2 for the contact.

  4. In the element bar, select a coil and drag it to the insert position to the right of the bInput_2 contact. Choose the name bOutput_1 for the coil.

  5. Declare all input and output variables.

    The series circuit will be programmed.

    _c4ld_img_binary_and_gate.png

The equivalent ST code:

PROGRAM AndGate
VAR    
    bInput_1: BOOL;    
    bInput_2 : BOOL;    
    bOutput_1 : BOOL;
END_VAR
bOutput_1 := bInput_1 AND bInput_2;

OR connection

The output signal returns TRUE when one of the input signals is TRUE. This kind of parallel circuit corresponds to a binary OR-connection.

  1. Drag a new network to the editor.

    1. In the element bar, click the _c4ld_icon_toolbar_network.png symbol and click the element to the insert position (rectangle) in the editor.

      A new network will be inserted.

    2. Double-click the title and choose the title OR Gate in the input field that will open.

    3. Double-click the comment and choose the comment Binary OR gate in the input field that will open.

  2. Specify a new contact.

    1. In the element bar, select a contact and drag it to the insert position in the network OR Gate.

    2. Assign the variable bInput_1 to the contact.

  3. Specify a new contact that is positioned parallel to bInput_1.

    1. In the element bar, select another contact.

      The network will show the possible insert positions.

    2. Click the insert position (downward-pointing triangle) to the left of the bInput_1 contact. 

      A parallel contact will be inserted into the network.

    3. Double-click the identifier field of the contact.

      The input field will open.

    4. Type in bInput_2.

      The variable bInput_2 will be assigned to the contact.

    5. Select the gray rectangle to the right of the bInput_2 contact.

      It is light red.

    6. Drag the cursor upwards to the parallel connection until the cursor is displayed as a four-headed arrow.

      When the cursor is displayed as a four-headed arrow, the cursor points to a valid position.

      _c4ld_img_binary_or_gate_selected_to_close_connection.png
    7. Release the left mouse button.

      The connection will be closed.

    The contact will be arranged in parallel.

  4. In the element bar, select a coil and drag it to the insert position to the right of the bInput_1 contact. Choose the name bOutput_1 for the coil.

  5. Declare all input and output variables.

    The parallel circuit will be programmed.

    _c4ld_img_binary_or_gate.png

The equivalent ST code:

PROGRAM OrGate
VAR    
    bInput_1: BOOL;    
    bInput_2 : BOOL;    
    bOutput_1 : BOOL;
END_VAR
bOutput_1 := bInput_1 OR bInput_2;

Opening a parallel connection

You can reopen a closed parallel connection by removing the insert position (rectangle) in the part to be removed. Alternatively, you could also drag the rectangles onto each other in order to undo the connection.

The parallel connection is reopened both times.

Procedure. Removing an insert position
  1. Trace the connecting line that you want to remove.

    The insert position will be displayed.

  2. Click the rectangle.

    The rectangle will be highlighted in light red.

    _c4ld_img_binary_or_gate_selected_for_deletion.png
  3. Press the Del key.

    The connection will be reopened.

    _c4ld_img_binary_or_gate_open.png
Procedure. Dragging back the connecting part
  1. Drag the connecting line to the right of the bInput_1 contact until the insert position is displayed.

  2. Click the rectangle while holding down the mouse button.

    The rectangle will be highlighted in light red.

  3. Drag the rectangle to the insert position to the right of the bInput_2 contact. Trace the connection until the cursor is displayed as a four-headed arrow.

    When the cursor is displayed as a four-headed arrow, point to a valid position.

    _c4ld_img_binary_or_gate_selected_for_deletion_2.png
  4. Release the left mouse button.

    The part will be removed and the connection will be opened.

    _c4ld_img_binary_or_gate_open.png