Package pyads :: Module pyads
[hide private]
[frames] | no frames]

Module pyads

source code

Created on 19.09.2013


Author: lehmann

Functions [hide private]
AdsVersion
adsGetDllVersion()
returns version, revision and build of the ads-dll
source code
int
adsPortOpen()
connects to the TwinCAT message router
source code
int
adsPortClose()
closes the connection to the TwinCAT message router
source code
AmsAddr
adsGetLocalAddress()
returns the local AMS-address and the port number
source code
(int, int, int)
adsSyncReadStateReq(adr)
reads the current ADS-state and the machine-state from the ADS-server
source code
int, string, AdsVersion
adsSyncReadDeviceInfoReq(adr)
reads the name and the version-number of the ADS-server
source code
int
adsSyncWriteControlReq(adr, adsState, deviceState, data, plcDataType)
changes the ads-state and the machine-state of the ADS-server
source code
int
adsSyncWriteReq(adr, indexGroup, indexOffset, value, plcDataType)
sends data synchronous to an ADS-device
source code
(int, PLCTYPE)
adsSyncReadReq(adr, indexGroup, indexOffset, plcDataType)
reads data synchronous from an ADS-device
source code
Variables [hide private]
  _adsDLL = CDLL("AdsDll.dll")
ADS-DLL (Beckhoff TwinCAT)
Function Details [hide private]

adsGetDllVersion()

source code 
Returns: AdsVersion
version, revision and build of the ads-dll

adsPortOpen()

source code 
Returns: int
port number

adsPortClose()

source code 
Returns: int
error state

adsGetLocalAddress()

source code 
Returns: AmsAddr
AMS-address

adsSyncReadStateReq(adr)

source code 
Parameters:
  • adr (AmsAddr) - local or remote AmsAddr
Returns: (int, int, int)
errCode, adsState, deviceState

adsSyncReadDeviceInfoReq(adr)

source code 
Parameters:
  • adr (AmsAddr) - local or remote AmsAddr
Returns: int, string, AdsVersion
errCode, device name, version

adsSyncWriteControlReq(adr, adsState, deviceState, data, plcDataType)

source code 
Parameters:
  • adr (AmsAddr) - local or remote AmsAddr
  • adsState (int) - new ADS-state, according to ADSTATE constants
  • deviceState (int) - new machine-state
  • data - additional data
  • plcDataType (int) - PLC-datatype, according to PLCTYPE constants
Returns: int
error-state of the function

Note: Despite changing the ADS-state and the machine-state it is possible to send additional data to the ADS-server. For current ADS-devices additional data is not progressed. Every ADS-device is able to communicate its current state to other devices. There is a difference between the device-state and the state of the ADS-interface (AdsState). The possible states of an ADS-interface are defined in the ADS-specification.

adsSyncWriteReq(adr, indexGroup, indexOffset, value, plcDataType)

source code 
Parameters:
  • adr (AmsAddr) - local or remote AmsAddr
  • indexGroup (int) - PLC storage area, according to the INDEXGROUP constants
  • indexOffset (int) - PLC storage address
  • value - value to write to the storage address of the PLC
  • plcDataType (int) - type of the data given to the PLC, according to PLCTYPE constants
Returns: int
error-state of the function

adsSyncReadReq(adr, indexGroup, indexOffset, plcDataType)

source code 
Parameters:
  • adr (AmsAddr) - local or remote AmsAddr
  • indexGroup (int) - PLC storage area, according to the INDEXGROUP constants
  • indexOffset (int) - PLC storage address
  • plcDataType (int) - type of the data given to the PLC, according to PLCTYPE constants
Returns: (int, PLCTYPE)
(errCode, value): errCode error-state of the function, value