LOGO is a small Siemens PLC suited for
implementing simple automation tasks in industry and building management
systems.
It’s very user friendly and the last model is
equipped with an Ethernet port for both programming and data exchange.
The Snap7 focus is on to S7300/400 systems, but
due to several requests, i decided to manage this PLC
as well.
Due to its architecture, the LOGO communication
is different from its Siemens cousins.
It implements two Ethernet protocols, the first
that we can call PG protocol, is used by the software LOGO Comfort (the
developing tool) to perform system tasks such as program upload/download,
run/stop and configuration.
The second, used for data exchange, is the well-known (from the Snap7 point of
view) S7 Protocol.
They are very different, and the first is not
covered by Snap7 because is a stand-alone protocol that is not present, Is far
I know, in different contexts.
Although LOGO uses the S7 Protocol, some small
changes (new connection functions added) were needed in Snap7 to manage it as
PLC Server by a Snap7Client.
You can use LOGO as Client connecting it to a
Snap7Server or you can connect a Snap7Client to a LOGO set as Server.
Finally, to communicate with LOGO, the Ethernet
connections must be designed with LOGO Comfort in advance.
Of course I will show you how.
For both type of communication (Client-Server
or Server-Client) LOGO must be set as MASTER (i.e. NORMAL mode as LOGO Comfort
says).
I assume that your LOGO Comfort is already set
and connected to the LOGO.
LOGO as
Server
Configuring a server connection allows
you to connect LOGO with Snap7Client for reading and writing the memory just
like an HMI panel would do.
· In the Tools menu choose the Ethernet
Connections item.
· Right click on ”Ethernet
Connections” and click ”Add connections” to add a connection
· Double-click the new connection
created and edit its parameters selecting Server Connection.
Note:
1. “Connect with an operator panel” checkbox can be checked or unchecked.
2. If you uncheck “Accept all connections” you must specify the PC address
(for now I suggest you to do it checked).
You can chose for Remote TSAP the same value of
the Local TSAP, in the example I used two different values to remark (as you
will see) the crossing parameters.
· Confirm the dialog, close the
connection editor and download the configuration into the LOGO.
· The LOGO is ready, to test it run
the new ClientDemo, insert the LOGO IP Address and
select the TSAP Tab for the connection as in figure.
Notice that the Local TSAP of the Client
corresponds to the Remote TSAP of the LOGO and vice-versa. This is the key
concept for the S7 connections.
The LOGO memory that we can Read/Write is the V
area that is seen by all HMI (and Snap7 too) as DB 1.
Into it are mapped all LOGO resources organized by bit, byte or word.
There are several tutorials in the Siemens site
that show how to connect an HMI (via WinCC flexible
or TIA) to the LOGO and the detailed map.
Please refer to them for further informations.
Finally, to connect to the LOGO by program with
the same parameters of above:
Client->SetConnectionParams(“192.168.0.73”,
0x0300, 0x0200); // C++
Client->Connect();
Client.SetConnectionParams(“192.168.0.73”, 0x0300,
0x0200); // C#
Client.Connect();
Client.SetConnectionParams(‘192.168.0.73’, $0300,
$0200); // Pascal
Client.Connect;
LOGO as
Client
LOGO can work as Client in two way :
1. Explicit
- using a client connection.
2. Implicit - via Network I/O blocks.
In both cases you can connect LOGO to a
Snap7Server that acts like a slave.
Client connection
· In the Tools menu choose the Ethernet
Connections item.
· Right click on ”Ethernet
Connections” and click ”Add connections” to add a connection
· Double-click the new connection
created and edit its parameters selecting Client Connection.
· Insert the Server IP Address, as
TSAP you can use whatever you want, since Snap7Server doesn’t care of it.
· In the second area you can specify
the data exchange area.
· As usual, confirm everything and
download the configuration into the LOGO.
At this point you can run the Server Demo, and
with the above configuration you should see something similar to this :
Four bytes of read request and one byte of
write request, as we expected.
Network I/O Blocks
Open a Diagram and, as example, create a
“loopback” between a network input and a network output.
Each network node requests a parametrization as in figure.
Here our LOGO sees Snap7Server as a LOGO Slave.
And this is what Snap7Server should show us:
Two bytes of read request and two byte of write
request, as we expected.
Finally
this is the connections editor of LOGO!Soft Comfort 8
(different window but absolutely the same concept)
VM
BLOCK |
VM ADDRESS START |
VM ADDRESS END |
FIELD LENGTH (BYTE) |
I |
1024 |
1031 |
8 |
AI |
1032 |
1063 |
32 |
Q |
1064 |
1071 |
8 |
AQ |
1072 |
1103 |
32 |
M |
1104 |
1117 |
14 |
AM |
1118 |
1245 |
128 |
NI |
1246 |
1261 |
16 |
NAI |
1262 |
1389 |
128 |
NQ |
1390 |
1405 |
16 |
NAQ |
1406 |
1469 |
64 |