Module Snap7Client

The class that creates an S7 communication protocol object.

Info:

  • Copyright: Debaru Kft. 2018
  • Release:
  • License: GNU
  • Author: Debaru Kft

Functions

Snap7Client () Creates an S7 communication platform using the Snap7 library.
start () Starts automatic polling.
db (db_number) Returns a Snap7DBLocator based on the db_number
status () Returns a Snap7PointLocator.

Fields

host Represents the host name of the PLC
remote_port Represents the TCP port number of the connection
rack Optional connection parameter, see Snap7 manual
slot Optional connection parameter, see Snap7 manual
local_tsap Optional connection parameter, see Snap7 manual
remote_tsap Optional connection parameter, see Snap7 manual
ping_timeout Optional connection parameter, see Snap7 manual
send_timeout Optional connection parameter, see Snap7 manual
receive_timeout Optional connection parameter, see Snap7 manual
round_delay Tells the system how much time it should wait between two query rounds.

Snap7DBLocator

bool (offset, bit) Returns a Snap7PointLocator.
byte (offset) Returns a Snap7PointLocator.
word (offset) Returns a Snap7PointLocator.
dword (offset) Returns a Snap7PointLocator.
int (offset) Returns a Snap7PointLocator.
dint (offset) Returns a Snap7PointLocator.
real (offset) Returns a Snap7PointLocator.
s5time (offset) Returns a Snap7PointLocator.
time (offset) Returns a Snap7PointLocator.
date (offset) Returns a Snap7PointLocator.
time_of_day (offset) Returns a Snap7PointLocator.
char (offset) Returns a Snap7PointLocator.

Snap7PointLocator

assign (tag) Assign an existing tag to a snap7 point.
tag () Create a new tag for a snap7 point.
writeonly () Sets tag writeonly (LuaPLC writes tag value to PLC) A read/write tag value is written to PLC if value is changed in LuaPLC, read from PLC if tag value differs from PLC value and tag value is unchanged.
readonly () Sets tag readonly (LuaPLC reads tag value from PLC).


Functions

Snap7Client ()
Creates an S7 communication platform using the Snap7 library.
start ()
Starts automatic polling.

Returns:

    bool
db (db_number)
Returns a Snap7DBLocator based on the db_number

Parameters:

  • db_number int

Returns:

    Snap7DBLocator
status ()
Returns a Snap7PointLocator. Status value is 0 for not connected, 1 for connected and PLC running, 2 for connected and PLC stopped.

Returns:

    Snap7PointLocator

Fields

host
Represents the host name of the PLC
remote_port
Represents the TCP port number of the connection
  • type int (default: 102)
rack
Optional connection parameter, see Snap7 manual
  • type int (default: 0)
slot
Optional connection parameter, see Snap7 manual
  • type int (default: 2)
local_tsap
Optional connection parameter, see Snap7 manual
remote_tsap
Optional connection parameter, see Snap7 manual
ping_timeout
Optional connection parameter, see Snap7 manual
send_timeout
Optional connection parameter, see Snap7 manual
receive_timeout
Optional connection parameter, see Snap7 manual
round_delay
Tells the system how much time it should wait between two query rounds. Resolution is in ms.
  • type int (default: 500)

Snap7DBLocator

bool (offset, bit)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
byte (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
word (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
dword (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
int (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
dint (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
real (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
s5time (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
time (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
date (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
time_of_day (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator
char (offset)
Returns a Snap7PointLocator.

Parameters:

Returns:

    Snap7PointLocator

Snap7PointLocator

assign (tag)
Assign an existing tag to a snap7 point.

Parameters:

tag ()
Create a new tag for a snap7 point.

Returns:

    Tag
writeonly ()
Sets tag writeonly (LuaPLC writes tag value to PLC) A read/write tag value is written to PLC if value is changed in LuaPLC, read from PLC if tag value differs from PLC value and tag value is unchanged.

Returns:

    Snap7PointLocator
readonly ()
Sets tag readonly (LuaPLC reads tag value from PLC). A read/write tag value is written to PLC if value is changed in LuaPLC, read from PLC if tag value differs from PLC value and tag value is unchanged.

Returns:

    Snap7PointLocator
generated by LDoc 1.4.6 Last updated 2023-09-25 09:31:08