ljean / modbus-tk

Create Modbus app easily with Python
Other
557 stars 211 forks source link

help modbus tcp server #111

Open othmakuf opened 5 years ago

othmakuf commented 5 years ago

hey guys i want to create a server modbus tcp that can send messages (example "hello") my project is to send messages to my plc through modbus tcp can anyone help me out

ljean commented 5 years ago

Hello,

If you want to send data to a PLC, I guess that your program must be a modbus master. There is an example in modbus_tk source code.

I hope it helps Best luc

Le 2 mai 2019 à 01:41, othmakuf notifications@github.com a écrit :

hey guys i want to create a server modbus tcp that can send messages (example "hello") my project is to send messages to my plc through modbus tcp can anyone help me out

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ljean/modbus-tk/issues/111, or mute the thread https://github.com/notifications/unsubscribe-auth/AACA2OYZ26K52PMKR354P7DPTITDVANCNFSM4HJ2P77Q.

othmakuf commented 5 years ago

that really helps i execute the scripts i get this error about the writing Traceback (most recent call last): File "C:/Users/othmane 2/Desktop/modbus master.py", line 59, in main() File "C:/Users/othmane 2/Desktop/modbus master.py", line 52, in main logger.info(master.execute(1, cst.WRITE_MULTIPLE_COILS, 0, output_value=[1, 1, 0, 1, 1, 0, 1, 1])) File "C:\ProgramData\Anaconda3\lib\site-packages\modbus_tk\utils.py", line 39, in new raise excpt File "C:\ProgramData\Anaconda3\lib\site-packages\modbus_tk\utils.py", line 37, in new ret = fcn(*args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\modbus_tk\modbus.py", line 298, in execute response = self._recv(expected_length) File "C:\ProgramData\Anaconda3\lib\site-packages\modbus_tk\modbus_tcp.py", line 216, in _recv rcv_byte = self._sock.recv(1) socket.timeout: timed out

ljean commented 5 years ago

Your PLC didn’t answer. I recommend to check the communication settings and make sure that the PLC receives and handle your queries

Le 2 mai 2019 à 14:00, othmakuf notifications@github.com a écrit :

that really helps i execute the scripts i get this error about the writing Traceback (most recent call last): File "C:/Users/othmane 2/Desktop/modbus master.py", line 59, in main() File "C:/Users/othmane 2/Desktop/modbus master.py", line 52, in main logger.info(master.execute(1, cst.WRITE_MULTIPLE_COILS, 0, output_value=[1, 1, 0, 1, 1, 0, 1, 1])) File "C:\ProgramData\Anaconda3\lib\site-packages\modbus_tk\utils.py", line 39, in new raise excpt File "C:\ProgramData\Anaconda3\lib\site-packages\modbus_tk\utils.py", line 37, in new ret = fcn(*args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\modbus_tk\modbus.py", line 298, in execute response = self._recv(expected_length) File "C:\ProgramData\Anaconda3\lib\site-packages\modbus_tk\modbus_tcp.py", line 216, in _recv rcv_byte = self._sock.recv(1) socket.timeout: timed out

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ljean/modbus-tk/issues/111#issuecomment-488645660, or mute the thread https://github.com/notifications/unsubscribe-auth/AACA2O27ZDT3DCP2NX2S7VTPTLJUVANCNFSM4HJ2P77Q.

othmakuf commented 5 years ago

thanks man that really helps!!!!