s7_modbus_client.py
Go to the documentation of this file.
00001 
00002 ########################################################################### 
00003 # This software is graciously provided by HumaRobotics 
00004 # under the Simplified BSD License on
00005 # github: git@www.humarobotics.com:baxter_tasker
00006 # HumaRobotics is a trademark of Generation Robots.
00007 # www.humarobotics.com 
00008 
00009 # Copyright (c) 2013, Generation Robots.
00010 # All rights reserved.
00011 # www.generationrobots.com
00012 #   
00013 # Redistribution and use in source and binary forms, with or without 
00014 # modification, are permitted provided that the following conditions are met:
00015 # 
00016 # 1. Redistributions of source code must retain the above copyright notice,
00017 #  this list of conditions and the following disclaimer.
00018 # 
00019 # 2. Redistributions in binary form must reproduce the above copyright notice,
00020 #  this list of conditions and the following disclaimer in the documentation 
00021 #  and/or other materials provided with the distribution.
00022 # 
00023 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00025 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
00026 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
00027 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00028 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00029 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00030 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00031 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00032 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
00033 # THE POSSIBILITY OF SUCH DAMAGE. 
00034 # 
00035 # The views and conclusions contained in the software and documentation are 
00036 # those of the authors and should not be interpreted as representing official 
00037 # policies, either expressed or implied, of the FreeBSD Project.
00038 
00039 from modbus.modbus_wrapper_client import ModbusWrapperClient
00040 class S7ModbusClient(ModbusWrapperClient):
00041     def __init__(self,host,port=502,rate=50,reset_registers=True):
00042         """
00043             :param host: Contains the IP adress of the modbus server
00044             :type host: string
00045             :param rate: How often the registers on the modbusserver should be read per second
00046             :type rate: float
00047             :param reset_registers: Defines if the holding registers should be reset to 0 after they have been read. Only possible if they are writeable
00048             :type reset_registers: bool
00049         """
00050 #         print("Use the appropriate Step7 Project to enable the Modbus Server on your Siemens S1200 PLC")
00051         ModbusWrapperClient.__init__(self,host,port,rate,reset_registers)
00052         self.setReadingRegisters(0,8)
00053         self.setWritingRegisters(8,9)
00054         #self.startListening()
00055         
00056         
00057         
00058     
00059 
00060     


modbus_plc_siemens
Author(s): Sven Bock
autogenerated on Thu Jun 6 2019 17:39:38