modbus-tk icon indicating copy to clipboard operation
modbus-tk copied to clipboard

help modbus tcp server

Open othmakuf opened this issue 6 years ago • 4 comments

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

othmakuf avatar May 01 '19 23:05 othmakuf

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 [email protected] 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.

ljean avatar May 02 '19 06:05 ljean

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

othmakuf avatar May 02 '19 12:05 othmakuf

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 [email protected] 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.

ljean avatar May 02 '19 12:05 ljean

thanks man that really helps!!!!

othmakuf avatar May 03 '19 17:05 othmakuf