Siemens LOGO! Device

PLC-Lab can be connected via Ethernet to a Siemens LOGO. This is possible with the LOGO controllers 0BA7, 0BA8, or newer.

Before a brief example shows the interaction between PLC-Lab and a LOGO, we will now look at the simulation and addressing of the different operand ranges of a Siemens LOGO.

Digital Inputs

Inputs of the LOGO controller can only be read. Writing to a digital input, e.g. via a push-button in PLC-Lab, has no effect on the input in the LOGO. For this reason, network inputs must be used for simulation. In LOGO, these are located in the V area, i.e. their address starts at V0.0. This V area is addressed in PLC-Lab via DB1 (data block 1). For example, to address the network input with the address V0.0 in PLC-Lab, enter DB1.DBX0.0 as operand.

Example for the simulation of a digital input: In a system, a push-button is connected to input I1 of LOGO. This push-button is to be simulated via PLC-Lab.

Procedure: In the first step, input I1 is routed to an OR block; a network input NI is inserted and also connected to the OR block. The network input is set to address V0.0.

This has the advantage that the signal of the push-button can come on the one hand via the input of the LOGO and on the other hand via the network input NI1. The network input is then influenced by the virtual PLC-Lab system. After the simulation, the circuit can be used unchanged on the real system. You can always use simulations with any later modifications.

The push-button in PLC-Lab is set to the operand "DB1.DBX0.0". This corresponds to the address V0.0 to which the network input NI1 is set.

Conclusion: Because digital inputs of a LOGO cannot be overwritten directly, their function must be taken over by network inputs. The preferred procedure is to connect the input and the network input to an OR block and to continue using the output of the OR block. This means that the circuit program can be used unchanged in the real system after the simulation. A later simulation of the program is possible at any time. The network inputs are connected to bit addresses of the V range in the LOGO. These V operands are addressed in PLC-Lab via DB1. The following table shows the relationship between V operands and the DB1 in PLC-Lab.

V area LOGO DB1 area PLC-Lab
V0.0 DB1.DBX0.0
V0.1 DB1.DBX0.1
V0.2 DB1.DBX0.2
V0.3 DB1.DBX0.3
V0.4 DB1.DBX0.4
V0.5 DB1.DBX0.5
V0.6 DB1.DBX0.6
V0.7 DB1.DBX0.7
V1.0 DB1.DBX1.0
V1.1 DB1.DBX1.1
V1.2 DB1.DBX1.2
V1.3 DB1.DBX1.3
V1.4 DB1.DBX1.4
V1.5 DB1.DBX1.5
V1.6 DB1.DBX1.6
V1.7 DB1.DBX1.7
.. ...

Analog inputs (AI)

Analog inputs of the LOGO controller can only be read. Writing to an analog input, e.g. via a slider object in PLC-Lab, has no effect on the analog input in LOGO. For this reason, analog network inputs must be used for the simulation. These are located in the LOGO in the V range, i.e. their address starts at VW 0 and is 16 bits wide. This V area is addressed in PLC-Lab via DB1. For example, to address the analog network input with the address VW0 in PLC-Lab, enter DB1.DBW0 as operand.

Example for the simulation of an analog input: The analog input AI1 is used in a circuit. Its function is to be simulated with the help of PLC-Lab.

Procedure: First, you have to replace the analog input AI1 with an analog network input. To do this, select an analog network input from the catalog of the LOGO programming software and drag it into the drawing board of the circuit over the analog input you want to replace. A + sign appears.

When you now drop the block of the analog network input over the AI1 (release the left mouse button), the block of the AI1 is replaced.

The analog network input has the address VW0. This address can be specified in the configuration dialog of the NAI.

The V addresses of the LOGO are addressed via DB1 within PLC-Lab. The address VW0 is represented by the address DB1.DBW0 in PLC-Lab. If, for example, the position value of a linear connection in PLC-Lab is to be written to this analog network input, the property of the connection for a linear movement must be filled in as follows:

The name of the logo device is defined as "LogoTest". Of course, you can also define a symbol for the operand DB1.DBW0 within the symbol table of PLC-Lab and then specify this symbol within the property of the connection for a linear movement.

Conclusion: Because analog inputs of a LOGO cannot be overwritten directly, their function must be taken over by analog network inputs. The preferred procedure is to replace the input with a network input. After the simulation, the analog network input can simply be replaced by the analog input again. This procedure can be done very quickly in the programming software (see example above). The analog network inputs are connected to word addresses of the V range in the LOGO. These V operands are addressed in PLC-Lab via DB1. The following table shows the relationship between V operands and the DB1 in PLC-Lab.

V area LOGO DB1 area PLC-Lab
VW0 DB1.DBW0
VW2 DB1.DBW2
VW4 DB1.DBW4
VW6 DB1.DBW6
VW8 DB1.DBW8
VW10 DB1.DBW10
VW12 DB1.DBW12
VW14 DB1.DBW14
VW16 DB1.DBW16
VW18 DB1.DBW18
... ...

Tip

To avoid conflicts, you should always use even-numbered addresses.

Digital output (Q)

Digital outputs of the LOGO controller can be both read and written in PLC-Lab. However, writing to an output, e.g. via a switch object in PLC-Lab, only works if the output is not written to in the circuit program of LOGO. Otherwise the status of the output is cyclically overwritten by the circuit program. Of course, reading an output always works. Thus the outputs of the LOGO can be used, for example, to control lamps in the virtual PLC-Lab system or to trigger movements of cylinders, linear movements, rotary movements, etc. The evaluation (reading) of an output within the virtual system of PLC-Lab is the norm.

The digital outputs of LOGO are addressed in PLC-Lab as follows:

Output of the LOGO Address in PLC-Lab
Q1 Q0.0
Q2 Q0.1
Q3 Q0.2
Q4 Q0.3
Q5 Q0.4
Q6 Q0.5
Q7 Q0.6
Q8 Q0.7
Q9 Q1.0
Q10 Q1.1
Q11 Q1.2
Q12 Q1.3
Q13 Q1.4
Q14 Q1.5
Q15 Q1.6
Q16 Q1.7
Q17 Q2.0
Q18 Q2.1
... ...

Example for using a digital output in PLC-Lab: In the following example, a lamp object is connected to the output Q1 of the LOGO. The device name of the LOGO in PLC-Lab is "LogoTest".

If the output Q1 of the LOGO has the status 1, then the lamp within PLC-Lab is illuminated.

Conclusion: Digital outputs of the LOGO can be addressed directly in PLC-Lab. Normally, these are read in the PLC-Lab system and corresponding actions are triggered in the virtual system (lamp illuminates, objects are moved, etc.). No changes need to be made in the LOGO circuit program for the simulation.

We have already shown above how you address the digital outputs.

Info

Note: The digital outputs used in the circuit program do not have to be present on the LOGO controller. The simulation can be carried out without the output being physically present.

Analog outputs (AQ)

Analog outputs can only be read in the virtual systems of PLC-Lab. This enables the status of an analog output to be displayed, for example, as a numerical value or in a tacho object. Access to the analog outputs is made via the V area of the LOGO. This V area is addressed in PLC-Lab via DB1.

The following table shows the addresses for a LOGO 0BA7:

Analog output of the LOGO Address in the V area Address in PLC-Lab
AQ1 VW944 DB1.DBW944
AQ2 VW946 DB1.DBW946

Now the addresses for a LOGO 0BA8:

Analog output of the LOGO Address in the V area Address in PLC-Lab
AQ1 VW1072 DB1.DBW1072
AQ2 VW1074 DB1.DBW1074
AQ3 VW1076 DB1.DBW1076
AQ4 VW1078 DB1.DBW1078
... ... ...
AQ16 VW1102 DB1.DBW1102

Tip

The LOGO!Soft Comfort online help gives you an overview of the V address assignments within the help topic "Tools -> Parameter VM Mapping (0BA7 and later versions only)".

Example for using an analog output in PLC-Lab: An analog output has been programmed in the circuit program as follows:

In the example we use a LOGO 0BA8. The value of the analog output AQ1 is now to be displayed in the PLC-Lab system. In this case we use a tacho object with a text label. Both objects are connected to the operand DB1.DBW1072.

When the "EN" push-button is pressed, the value 300 is written to the analog output AQ1. You can see this on the tacho object and in the text label.

Conclusion: The analog outputs of the LOGO can be read in PLC-Lab via the respective word addresses. No changes are necessary in the circuit program.

Digital and analog flags

The digital and analog flags of the LOGO are accessed via their V area. As a result, these operands are addressed in PLC-Lab via DB1.

Digital flags

The following table lists the digital flags of a 0BA7.

Digital flag of the LOGO Address in the V area Address in PLC-Lab
M1 V948.0 DB1.DBX948.0
M2 V948.1 DB1.DBX948.1
... ... ...
M15 V949.6 DB1.DBX949.6
M16 V949.7 DB1.DBX949.7

Now the table for a LOGO starting with 0BA8:

Digital flag of the LOGO Address in the V area Address in PLC-Lab
M1 V1104.0 DB1.DBX1104.0
M2 V1104.1 DB1.DBX1104.1
... ... ...
M.. V1117.6 DB1.DBX1117.6
M.. V1117.7 DB1.DBX1117.7

Example: If an object in PLC-Lab is to access the digital marker M10 of a 0BA7, the address DB1.DBX949.1 must be specified.

Analog flags

The following table shows the analog flags of a LOGO 0BA7.

Analog flag of the LOGO Address in the V-area Address in PLC-Lab
AM1 VW952 DB1.DBW952
AM2 VW954 DB1.DBW954
... ... ...
AM16 VW982 DB1.DBW982

Now the addresses for a LOGO 0BA8:

Analog flag of the LOGO Address in the V-area Address in PLC-Lab
AM1 VW1118 DB1.DBW1118
AM2 VW1120 DB1.DBW1120
... ... ...
AM64 VW1244 DB1.DBW1244

Example: If an object in PLC-Lab is to access the analog flag AM2 of a 0BA8, the address DB1.DBW1120 must be specified.

Below, we show an example in which a system is created in PLC-Lab and used to simulate a control program in a Siemens LOGO controller. A 0BA8 is used as a LOGO, but the example also applies to 0BA7 devices or LOGOs that are more recent than the 0BA8.

The following steps are carried out:

  • Creating a new project in the Siemens LOGO programming software. In this step, the LOGO device with Ethernet interface required for the simulation is set and configured.
  • Writing the control program with the Siemens LOGO programming software.
  • Creating a new system in PLC-Lab
  • Testing of the control program in the LOGO with the help of the virtual PLC-Lab system and the Siemens LOGO programming software

Introduction of the control task to be realized with LOGO: The control task to be implemented is deliberately kept simple. The focus of the example is on explaining the interaction between PLC-Lab and LOGO.

Task description: A lamp is switched on with a push-button and switched off with a second push-button. The OFF push-button should be designed as an 'normally closed contact' and provide the status '1' in idle state. Below you can see the assignment of the inputs and outputs on the LOGO:

Operand Function
I1 Push-button on
I2 Push-button off
Q1 Lamp

Generating a new project in the Siemens LOGO programming software: After starting the programming software "LOGO!Soft Comfort" version 8.2 or higher, select the menu item "File->New->Function block diagram". The control program can also be created in ladder diagram. In the next step, select the device. As this example involves a LOGO! 8.FS4, you have to select it. Select the menu item "Tools->Select hardware" and choose the device that appears in the dialog.

When the device has been selected, confirm the dialog with OK.

Setting the IP address data of the LOGO: In order to be able to address the LOGO via Ethernet, it must be assigned with an IP address. The device must be accessible for the PC with the LOGO programming software and PLC-Lab. The LOGO controller can be connected directly to the network card of the PC or via a switch in the network.

In the example, we assume that the PC with the programming software and PLC-Lab has the IP address 192.168.1.107. The LOGO controller should be located in the same subnet and, for the sake of simplicity, differs only in the last digit of the IP address. For this reason, the LOGO controller should be assigned the IP address 192.168.1.189. Keep in mind that this IP address cannot be assigned yet.

The IP address and subnet mask of the LOGO controller can be set rapidly via the LOGO display. To do this, press the ESC key on the LOGO to enter the menu. Then use the up and down arrow keys to select the "Network" menu item and confirm with the OK key. In the submenu, select the menu item "IP address" via OK. You will then see the currently set IP address. Press the OK key once more to be able to set the individual addresses using the arrow keys. As mentioned earlier, we use the address 192.168.1.189 in the example. When this address has been set, you can accept the entry via OK. Now on to the subnet mask. In the example, the subnet mask has the setting 255.255.255.0. From the current position, you can select the subnet mask by pressing the down arrow key and start changing it by choosing OK. When 255.255.255.0 has been set, you complete the entry with OK. For further information on setting the IP data in the LOGO device, please refer to the corresponding sections in the help of the LOGO programming software or the manual of the LOGO controller.

Now the IP data are set in the LOGO control. You can return to the main menu of the LOGO by pressing the LOGO key "ESC".

Parameterizing the Ethernet connection in the LOGO programming software: Next, execute the menu item "Tools->Ethernet Connections" in the LOGO programming software. A dialog appears as a result. In the example, fill in this dialog as follows:

Specify the IP address of the LOGO to be addressed in the field "Module address -> IP address"; in the example the IP address is 192.168.1.189. When this IP address has been given, the subnet mask is specified automatically. Below this you can see the field "Ethernet Connections". You have to create a new Ethernet connection in this field. Select "Ethernet Connections", press the right mouse button and select the following sub-menu:

The dialogue is then as follows:

A new connection has been added. Next, double-click on this connection and fill in the dialog as follows:

Afterwards you can exit the dialog via OK. Confirm and exit the now active dialog with the module address and the Ethernet connections via OK.

The IP settings are now complete and programming can be started.

Developing the control program with the Siemens LOGO programming software: Push-buttons are connected to both inputs I1 and I2. The "Start" push-button is designed as a 'normally open contact', the "Stop" push-button as an 'normally closed contact'. Because the control program is to be tested with PLC-Lab and no hardware other than the LOGO itself is to be used, the inputs in the control program are to be supplemented by network inputs. These network inputs can then be influenced by the virtual system. You now have two options.

  • The network inputs 1 and 2 are used instead of the inputs I1 and I2 in the control program.
  • The inputs I1 and I2 are used in the control program. In addition, I1 is OR-linked to network input 1 and I2 to network input 2 via an AND block (with subsequent negation). This means that the signal from I1 and the signal from network input 1 are routed to an OR element. The signal of the I2 and the network input 2 are connected to an AND element with subsequent negation.

The second option has the advantage that no changes need to be made to the control program after the simulation. Furthermore, the simulation can be carried out again immediately after a later extension. For this reason, we use the second option in the example. As a rule, this should be the preferred option.

The control program now looks like this:

Input I1 and network input NI1 are connected to an OR element. Status 1 is thus supplied either via input I1 or network input NI1. Input I2 and network input NI2 are connected via an AND element with a subsequent negation. This is necessary because the "Stop" push-button is designed as an 'normally closed contact'.

Please note that the addresses of the network inputs must be set according to their location. In the example, the network input 1 has the address V0.0. NI2 is assigned the address V0.1.

The actual functionality of the task is achieved via the RS element B001. Its output can be fed directly to output Q1. The lamp is connected to Q1.

The control program is now complete. You can save the circuit via the menu item "File->Save".

Transferring the control program to the Siemens LOGO:

To transfer the program, execute the menu item "Tools->Transfer->PC-LOGO" in the LOGO programming software. In the dialog that appears, enter the address of the LOGO as the destination IP address. In the example this is the address 192.168.1.189.

Starting PLC-Lab and creating a system:

Now the virtual system can be created in PLC-Lab to test the circuit program. PLC-Lab is started and a new system project is created:

Shortly after pressing the "New" button, the PLC-Lab program window with the drawing board appears.

Creating and selecting a device and creating symbols: For this example we need three operands, which have to be created in the symbol table first. In the first step you have to create a new device which defines the connection to LOGO. The three operands must then be assigned to this device. To create a new device, click on the following button in the symbol table:

The dialog "Create a new device or connection" appears. Fill this dialog in as follows.

A Siemens LOGO is selected as the device type and a name is specified for the device. In the example, we used the name "Logo01". Then confirm the dialog. A dialog with the connection parameters appears. In this dialog, select the IP address of the connected LOGO and the network card to be used in the PC to which the LOGO is connected.

In the example, the LOGO has the IP address 192.168.1.189, which is why it must be specified as the IP address. Then confirm the data you have entered with OK. The new device is selected as active device. If this is not the case, it must still be selected in the list of existing devices.

Info

Make sure that you select the correct network card from the list.

As a result, the operands that have been added to the symbol table are automatically assigned to this device. The first operand is added to the symbol table by clicking the plus button.

You now need to change the symbol of the operand to "Start". To do this, click on the cell of the symbol.

and enter the name.

Use the TAB key to jump to the next column of the symbol table. Here you can specify the operand. The button is to influence the network input with the address V0.0. So DB1.DBX0.0 must be specified as operand.

To insert the next operand, press the button with the plus sign again.

Now there is another operand in the symbol table behind the currently selected operand. Its address is increased to such an extent that there is no address overlap. With a bit operand, this means that the bit address is increased by one.

The standard symbol of this operand should also be replaced by another symbol; in this case, specify the symbol "Stop".

The operand as such is correct; it is DB1.DBX0.1, which addresses the network input at V0.1.

Finally, the operand is required for output Q1 of the LOGO. For this purpose, Q0.0 or A0.0 must be specified as operand in PLC-Lab. The specification "Q0.0" uses the English syntax. It is irrelevant if German or English syntax is used. Now you select the second line of the symbol table (if not already selected) and click the plus button again. Then the designation "LampStart" and the correct operand are indicated as the symbol. These steps are shown below:

Drawing the first push-button: Now all operands are available in the symbol table. The next step is to create the objects you need for the system on the PLC-Lab drawing board. In the example you need two push-buttons and a lamp. Start with the "Ein" push-button. Within the tools, select the object type "Switches not illuminated":

Then move the mouse to the position within the drawing board where you want to place the switch. The mouse pointer now resembles a cross. Use the left mouse button to drag the switch object onto the drawing board. When you let go of the mouse button, the process is completed.

In the next image, you can see the steps for placing the switch object; the Shift key was pressed while dragging the object:

After the switch has been placed, its properties are displayed in the object properties table. In the example, the operand to which the switch object is connected should be specified first. It will be affected when the switch is actuated. Two options are available for specifying the operand.

First option "Autocompletion": In the first option, in the cell for the operand, the device name followed by a period is specified first; in the example, this is "Logo01.". Then use the key combination Ctrl + Space. As a result, all symbols of this device are now displayed in a list. Select the symbol you want to use with the cursor keys (../up or down) and confirm with the return key. The selected symbol is then entered as an operand. These steps are shown below:

Second option "Drag & Drop": With the second option, you select the line of the operand in the symbol table and then drop it on the description of the operand property using drag & drop.

Third option "Drag & Drop" on the Object: Now for the third option. In this case, you also select the operand from the symbol table and then drag and drop it. But here the target is the switch. This means that the operand is dropped directly on the object. For switch objects, the operand you have inserted is automatically inserted as the operand that is affected by the switch.

Info

The advantage of the options 2 and 3 is that the symbol of the operand is automatically used to label the switch object.

When you have used one of the options, the switch is connected to the symbol "Start" and thus to the DB1.DBX0.0. Now the switch object must be defined as a push-button. Furthermore, "Start" should appear as text with a font size of "12" in the switch object. The properties required for this are shown below:

Drawing the second push-button: And now to the second switch. We want to create this switch from a copy of the first switch. Select the first switch and press Ctrl + D. A copy of the selected switch is then placed next to the source object.

In the next step you have to adjust the operand of the switch. This is supposed to be the "Stop" push-button. We will do this using the third option described above. The operand with the symbol "Stop" in the symbol table is dropped over the switch object using drag & drop.

To display the properties of the switch in the table, click on a free space in the draw-window and then select the new switch with the mouse. Now the properties are displayed and can be changed. Since the button is to be set as an opener, the property "Button is an opener" is selected.

These changes are shown below.

Drawing a lamp: Finally, we need a lamp object to signal the state "Start". For this purpose, select a green indicator light in the object selection "Lamps->Indicator lights". The lamp can then be placed on the drawing board. And in the next step, we assign the operand with the symbol "Lamp" to the object.

We also remove the caption from the lamp. This means that no more text is displayed in the object.

After these actions, the drawing board looks as follows:

All objects are available for the example. If required, you can save the layout by pressing Ctrl + S.

Changing to LOGO!Soft and switching on the online test: Now you can switch back to the LOGO software. If the circuit program has not yet been transferred, you can do this via the menu item "Tools->Transfer->PC->LOGO". The online test is then switched on. Below you can see the button you have to click on in the LOGO software.

This means that the RUN mode and thus the simulation can be started in PLC-Lab.

Within a few seconds, PLC-Lab will indicate that it is connected to LOGO.

Testing the circuit program: Now you can use the virtual system in PLC-Lab for testing.