python-snap7
1.0
  • Introduction
  • Installation
  • development
  • Client
  • Server
  • Partner
  • Logo
  • Util
python-snap7
  • Docs »
  • Logo
  • Edit on GitHub

Logo¶

class snap7.logo.Logo[source]¶

A snap7 Siemens Logo client: There are two main comfort functions available Logo.read() and Logo.write(). This functions realize a high level access to the VM addresses of the Siemens Logo just use the form:

  • V10.3 for bit values
  • V10 for the complete byte
  • VW12 for a word (used for analog values)

For more information see examples for Siemens Logo 7 and 8

connect(ip_address: str, tsap_snap7: int, tsap_logo: int, tcpport: int = 102) → int[source]¶

Connect to a Siemens LOGO server. Howto setup Logo communication configuration see: http://snap7.sourceforge.net/logo.html

Parameters:
  • ip_address – IP ip_address of server
  • tsap_snap7 – TSAP SNAP7 Client (e.g. 10.00 = 0x1000)
  • tsap_logo – TSAP Logo Server (e.g. 20.00 = 0x2000)
create()[source]¶

create a SNAP7 client.

db_read(db_number: int, start: int, size: int) → bytearray[source]¶

This is a lean function of Cli_ReadArea() to read PLC DB.

Parameters:
  • db_number – for Logo only DB=1
  • start – start address for Logo7 0..951 / Logo8 0..1469
  • size – in bytes
Returns:

array of bytes

db_write(db_number: int, start: int, data: bytearray) → int[source]¶

Writes to a DB object.

Parameters:
  • db_number – for Logo only DB=1
  • start – start address for Logo7 0..951 / Logo8 0..1469
  • data – bytearray
destroy()[source]¶

destroy a client.

disconnect() → int[source]¶

disconnect a client.

get_connected() → bool[source]¶

Returns the connection status

Returns:a boolean that indicates if connected.
get_param(number) → int[source]¶

Reads an internal Logo object parameter.

Parameters:number – Parameter type number
Returns:Parameter value
read(vm_address: str)[source]¶

Reads from VM addresses of Siemens Logo. Examples: read(“V40”) / read(“VW64”) / read(“V10.2”)

Parameters:vm_address – of Logo memory (e.g. V30.1, VW32, V24)
Returns:integer
set_connection_params(ip_address: str, tsap_snap7: int, tsap_logo: int)[source]¶

Sets internally (IP, LocalTSAP, RemoteTSAP) Coordinates. This function must be called just before Cli_Connect().

Parameters:
  • ip_address – IP ip_address of server
  • tsap_snap7 – TSAP SNAP7 Client (e.g. 10.00 = 0x1000)
  • tsap_logo – TSAP Logo Server (e.g. 20.00 = 0x2000)
set_connection_type(connection_type: int)[source]¶

Sets the connection resource type, i.e the way in which the Clients connects to a PLC.

Parameters:connection_type – 1 for PG, 2 for OP, 3 to 10 for S7 Basic
set_param(number: int, value)[source]¶

Sets an internal Server object parameter.

Parameters:
  • number – Parameter type number
  • value – Parameter value
write(vm_address: str, value: int) → int[source]¶

Writes to VM addresses of Siemens Logo. Example: write(“VW10”, 200) or write(“V10.3”, 1)

Parameters:
  • vm_address – write offset
  • value – integer
Next Previous

© Copyright 2013, Gijs Molenaar, Stephan Preeker Revision 83add056.

Built with Sphinx using a theme provided by Read the Docs.