minimalmodbus-list Mailing List for minimalmodbus (Page 2)
Status: Beta
Brought to you by:
pyhys
This list is closed, nobody may subscribe to it.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
(6) |
Aug
(1) |
Sep
(2) |
Oct
(3) |
Nov
(1) |
Dec
(4) |
2013 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
|
Aug
(9) |
Sep
|
Oct
|
Nov
(5) |
Dec
(3) |
2014 |
Jan
(11) |
Feb
(2) |
Mar
(1) |
Apr
(3) |
May
(6) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(7) |
Nov
(3) |
Dec
|
2015 |
Jan
(2) |
Feb
(6) |
Mar
|
Apr
(2) |
May
(5) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
(3) |
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
(5) |
May
|
Jun
|
Jul
(1) |
Aug
(11) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2017 |
Jan
|
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Olivier M. <om...@re...> - 2016-08-08 21:53:12
|
Hi I think that is a problem with pyserial in the new raspbian... They changed something with the tty console. I did a program for raspberry-pi in 2014 and renew it in the lasts few month and I had a problem like this. Regards, Envoyé de mon appareil Samsung de Bell via le réseau le plus vaste au pays. -------- Message d'origine -------- De : Jonas Berg <jon...@ho...> Date : 16-08-08 4:43 PM (GMT-05:00) À : fab...@gm... Cc : min...@li... Objet : Re: [Minimalmodbus-list] problem no communication with Raspberrywith Jessie Hi Fabio, thanks for your report! This is very strange! Can you please turn on the debug mode, and paste the output in a mail. See https://minimalmodbus.readthedocs.io/en/master/debugmode.html<http://https://minimalmodbus.readthedocs.io/en/master/debugmode.html> My guess is that it might have something to do with the drivers for your RS485 adapter. Best regards Jonas <-----Ursprungligt Meddelande-----> From: Fabio Stranieri [fab...@gm...] Sent: 5/8/2016 6:07:26 PM To: min...@li... Subject: Re: [Minimalmodbus-list] problem no communication with Raspberrywith Jessie I want to add this information: python version 2.7 Raspian 4.4.11 -V7+ #888 minimalmodbus NO work. Raspian 4.1.19 -V7+ #858 minimalmodbus work perfectly. BR On 5 August 2016 at 15:50, Fabio Stranieri <fab...@gm...<mailto:fab...@gm...>> wrote: Hi, I have 2 Raspberry Pi 2. On the first there is a Raspbian Jessie 2015 version and minimalmodbus work fine without problem. On the second Raspberry Pi 2 there is the last Raspbian Jessie 2016-05-27 kernel version 4.4. I have a clean installation with only minimalmodbus and there is not way to communicate. I use same file.py to test the communication. But I have always the same answer: "No communication with the instrument (no answer). Of course if I put in the second raspberry pi the sd card of the first raspberry PI, it work fine. What is change in the last Raspbian that prevents to minimalmodbus to work fine? Best Regards -- Fabio -- Fabio Stranieri |
From: Jonas B. <jon...@ho...> - 2016-08-08 20:42:59
|
Hi Fabio, thanks for your report! This is very strange! Can you please turn on the debug mode, and paste the output in a mail. See https://minimalmodbus.readthedocs.io/en/master/debugmode.html <http://https://minimalmodbus.readthedocs.io/en/master/debugmode.html> My guess is that it might have something to do with the drivers for your RS485 adapter. Best regards Jonas <-----Ursprungligt Meddelande-----> From: Fabio Stranieri [fab...@gm...] Sent: 5/8/2016 6:07:26 PM To: min...@li... Subject: Re: [Minimalmodbus-list] problem no communication with Raspberrywith Jessie I want to add this information: python version 2.7 Raspian 4.4.11 -V7+ #888 minimalmodbus NO work. Raspian 4.1.19 -V7+ #858 minimalmodbus work perfectly. BR On 5 August 2016 at 15:50, Fabio Stranieri < fab...@gm... <mailto:fab...@gm...> > wrote: Hi, I have 2 Raspberry Pi 2. On the first there is a Raspbian Jessie 2015 version and minimalmodbus work fine without problem. On the second Raspberry Pi 2 there is the last Raspbian Jessie 2016-05-27 kernel version 4.4. I have a clean installation with only minimalmodbus and there is not way to communicate. I use same file.py to test the communication. But I have always the same answer: "No communication with the instrument (no answer). Of course if I put in the second raspberry pi the sd card of the first raspberry PI, it work fine. What is change in the last Raspbian that prevents to minimalmodbus to work fine? Best Regards -- Fabio -- Fabio Stranieri |
From: Jonas B. <jon...@ho...> - 2016-08-08 20:42:58
|
Hi Chris, sorry for the delay in my response. This seems to be an electrical error. I have described it here: https://minimalmodbus.readthedocs.io/en/master/troubleshooting.html#empt y-bytes-added-in-the-beginning-or-the-end-on-the-received-message <http://https://minimalmodbus.readthedocs.io/en/master/troubleshooting.h tml#empty-bytes-added-in-the-beginning-or-the-end-on-the-received-messag e> Best regards Jonas <-----Ursprungligt Meddelande-----> From: Chris S [cgs...@gm...] Sent: 19/7/2016 7:18:02 PM To: min...@li... Subject: [Minimalmodbus-list] Modbus - Checksum - Extra 00 at start and end I have seen a question similar to mine but the response was to try a different adapter.. I am not sure if it was resolved or just not on the mailing list because I am unable to find it... The problem I am having with my minimalmodbus is that the RETURNED communication has extra 00 at the START and END of the code. Sending codes is fine it works and turns things on and off as expected but the communication I get back is something like ser.write_bit(1,1,5) With Precalculate Off 00\01\05\00\01\FF\00\dd\fa\00 With Precalculate On 00\01\05\00\01\FF\00\dd Or ser.read_register(2,1,4,False) # to read voltage I get back with Precal Off 00\01\04\02\00{\f9\13\00 I believe that extra 00 is giving me my Checksum error I have tried the trick of cutting off the extra bit on the end but I don't know how to do that for the beginning. If I comment out the checksum function, next I get is a incorrect slave ID because its reading that first 00. Right now I am using a RoHS USB-RS485-WE, I ordered a different brand to try but its in post. Is the connection turning on and off possibly creating the extra 00? If the other brand adapter doesnt work, is there a quick fix to get drop the first 00?? Thanks guys! - Chris |
From: Fabio S. <fab...@gm...> - 2016-08-05 16:03:34
|
I want to add this information: python version 2.7 Raspian 4.4.11 -V7+ #888 minimalmodbus NO work. Raspian 4.1.19 -V7+ #858 minimalmodbus work perfectly. BR On 5 August 2016 at 15:50, Fabio Stranieri <fab...@gm...> wrote: > Hi, > > I have 2 Raspberry Pi 2. On the first there is a Raspbian Jessie 2015 > version and minimalmodbus work fine without problem. > > On the second Raspberry Pi 2 there is the last Raspbian Jessie 2016-05-27 > kernel version 4.4. > I have a clean installation with only minimalmodbus and there is not way > to communicate. > I use same file.py to test the communication. But I have always the same > answer: "No communication with the instrument (no answer). Of course if I > put in the second raspberry pi the sd card of the first raspberry PI, it > work fine. > > What is change in the last Raspbian that prevents to minimalmodbus to > work fine? > Best Regards > > -- > Fabio > -- Fabio Stranieri |
From: Fabio S. <fab...@gm...> - 2016-08-05 13:50:57
|
Hi, I have 2 Raspberry Pi 2. On the first there is a Raspbian Jessie 2015 version and minimalmodbus work fine without problem. On the second Raspberry Pi 2 there is the last Raspbian Jessie 2016-05-27 kernel version 4.4. I have a clean installation with only minimalmodbus and there is not way to communicate. I use same file.py to test the communication. But I have always the same answer: "No communication with the instrument (no answer). Of course if I put in the second raspberry pi the sd card of the first raspberry PI, it work fine. What is change in the last Raspbian that prevents to minimalmodbus to work fine? Best Regards -- Fabio |
From: Chris S <cgs...@gm...> - 2016-07-19 17:14:17
|
I have seen a question similar to mine but the response was to try a different adapter.. I am not sure if it was resolved or just not on the mailing list because I am unable to find it... The problem I am having with my minimalmodbus is that the RETURNED communication has extra 00 at the START and END of the code. Sending codes is fine it works and turns things on and off as expected but the communication I get back is something like ser.write_bit(1,1,5) With Precalculate Off 00\01\05\00\01\FF\00\dd\fa\00 With Precalculate On 00\01\05\00\01\FF\00\dd Or ser.read_register(2,1,4,False) # to read voltage I get back with Precal Off 00\01\04\02\00{\f9\13\00 I believe that extra 00 is giving me my Checksum error I have tried the trick of cutting off the extra bit on the end but I don't know how to do that for the beginning. If I comment out the checksum function, next I get is a incorrect slave ID because its reading that first 00. Right now I am using a RoHS USB-RS485-WE, I ordered a different brand to try but its in post. Is the connection turning on and off possibly creating the extra 00? If the other brand adapter doesnt work, is there a quick fix to get drop the first 00?? Thanks guys! - Chris |
From: Jonas B. <jon...@ho...> - 2016-04-25 20:51:44
|
Hi, yes it should be possible to use MinimalModbus in RTU mode. The Modbus details for your instrument are described in the document "PM3200 series - Power Meters - User Manual". See http://download.schneider-electric.com/files?p_File_Id=2007131583&p_File _Name=DOCA0006EN-05.pdf <http://download.schneider-electric.com/files?p_File_Id=2007131583&p_Fil e_Name=DOCA0006EN-05.pdf> Best regards Jonas <-----Ursprungligt Meddelande-----> From: Olivier Maily [om...@re...] Sent: 25/4/2016 9:21:48 PM To: lgk...@gm...;min...@li... Cc: cra...@gm... Subject: Re: [Minimalmodbus-list] I need an advise Hi I used a raspberry Pi with minimal modbus and this worked well. I used a cable USB TTL232R3V3 I try as well with the Raspberry GPIO and worked well. Just the RS485 that changed with your application and I don't know if compatible with raspberry. Regards, Olivier Maïly Programmation & Support France header_logo 1600, 55ème Avenue Lachine (Québec) H8T 3J5 Tél. : +1 514 636-2878, poste 1621 Cell. : +1 514 206-8242 Tél. Fr : +33 970 405 490 www.regulvar.com <http://www.regulvar.com/> Ce courriel est confidentiel. Si vous l'avez reçu par erreur, veuillez nous en informer et le supprimer. Il est interdit à toute personne autre que le destinataire visé d'utiliser, copier ou diffuser ce message. | This email is confidential. If you have received it in error, please delete it and notify us. Any person other than the intended recipient is strictly prohibited from using, copying or distributing this message. De : Lazaros Georgiou [mailto:lgk...@gm...] Envoyé : 20 avril 2016 02:35 À : min...@li... Cc : ??????? ??????? Objet : [Minimalmodbus-list] I need an advise Dear sir. Lately i am working on a project for my degree essay in university trying to read data with Raspberry Pi 2 from the power analyzer PM3255 http://download.schneider-electric.com/files?p_File_Id=1262211195&p_File _Name=S1B46607-04.pdf <http://download.schneider-electric.com/files?p_File_Id=1262211195&p_Fil e_Name=S1B46607-04.pdf> via RS-485 to USB adapter. http://www.aliexpress.com/item/1-pcs-USB-to-RS485-USB-485-Converter-Adap ter-Support-Win7-XP-Vista-Linux-for-Mac/1684582905.html?spm=2114.4001050 8.4.14.eZQC0m Do you think that your software can help me, if i make the proper changes to all the files that are included in github source? https://github.com/pyhys/minimalmodbus Thank You! |
From: Olivier M. <om...@re...> - 2016-04-25 19:35:29
|
Hi I used a raspberry Pi with minimal modbus and this worked well. I used a cable USB TTL232R3V3 I try as well with the Raspberry GPIO and worked well. Just the RS485 that changed with your application and I don’t know if compatible with raspberry. Regards, Olivier Maïly Programmation & Support France [header_logo] 1600, 55ème Avenue Lachine (Québec) H8T 3J5 Tél. : +1 514 636-2878, poste 1621 Cell. : +1 514 206-8242 Tél. Fr : +33 970 405 490 www.regulvar.com<http://www.regulvar.com/> Ce courriel est confidentiel. Si vous l’avez reçu par erreur, veuillez nous en informer et le supprimer. Il est interdit à toute personne autre que le destinataire visé d’utiliser, copier ou diffuser ce message. | This email is confidential. If you have received it in error, please delete it and notify us. Any person other than the intended recipient is strictly prohibited from using, copying or distributing this message. De : Lazaros Georgiou [mailto:lgk...@gm...] Envoyé : 20 avril 2016 02:35 À : min...@li... Cc : Χρήστος Ραβάνης Objet : [Minimalmodbus-list] I need an advise Dear sir. Lately i am working on a project for my degree essay in university trying to read data with Raspberry Pi 2 from the power analyzer PM3255 http://download.schneider-electric.com/files?p_File_Id=1262211195&p_File_Name=S1B46607-04.pdf via RS-485 to USB adapter. http://www.aliexpress.com/item/1-pcs-USB-to-RS485-USB-485-Converter-Adapter-Support-Win7-XP-Vista-Linux-for-Mac/1684582905.html?spm=2114.40010508.4.14.eZQC0m Do you think that your software can help me, if i make the proper changes to all the files that are included in github source? https://github.com/pyhys/minimalmodbus Thank You! |
From: Lazaros G. <lgk...@gm...> - 2016-04-20 06:34:41
|
*Dear sir.* *Lately i am working on a project for my degree essay in university trying to read data with Raspberry Pi 2 from the power analyzer PM3255 * http://download.schneider-electric.com/files?p_File_Id=1262211195&p_File_Name=S1B46607-04.pdf *via RS-485 to USB adapter. * http://www.aliexpress.com/item/1-pcs-USB-to-RS485-USB-485-Converter-Adapter-Support-Win7-XP-Vista-Linux-for-Mac/1684582905.html?spm=2114.40010508.4.14.eZQC0m *Do you think that your software can help me, if i make the proper changes to all the files that are included in github source?* https://github.com/pyhys/minimalmodbus *Thank You!* |
From: Niall B. <Nia...@sa...> - 2016-04-13 19:39:03
|
output from diagnostic command: Minimalmodbus version: 0.7 Minimalmodbus status: Beta File name (with relative path): minimalmodbus.pyc Full file path: C:\MinimalModbus-0.7\MinimalModbus-0.7\minimalmodbus.pyc pySerial version: 2.7 pySerial full file path: C:\Python27\lib\site-packages\serial\__init__.pyc Platform: win32 Filesystem encoding: 'mbcs' Byteorder: little Python version: 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] Python version info: sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0) Python flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, division_new=0, inspect=0, interactive=0, optimize=0, Python argv: [''] Python prefix: 'C:\\Python27' Python exec prefix: 'C:\\Python27' Python executable: 'C:\\Python27\\python.exe' Long info: sys.long_info(bits_per_digit=15, sizeof_digit=2) Float repr style: 'short' Variable __name__: minimalmodbus Current directory: C:\MinimalModbus-0.7\MinimalModbus-0.7 Python path: C:\Windows\system32\python27.zip C:\Python27\DLLs C:\Python27\lib C:\Python27\lib\plat-win C:\Python27\lib\lib-tk C:\Python27 C:\Python27\lib\site-packages ## End of diagnostic output ## From: Niall Byrne Sent: Wednesday, April 13, 2016 1:28 PM To: 'min...@li...' Subject: trying communicate to CSK EZT-570i using Minimal Modbus IOError: No communication with the instrument (no answer) Hi there Trying to communicate with CSK EZT-570i environmental chamber using MinimalModbus via Null modem cable connected to a RS-232 to USB adapter to my laptop. However I keep getting IOError: No communication with the instrument (no answer) even see this with the Null modem cable disconnected. I installed MinimalModbus on a Windows 7 laptop, I was going to try it on Ubuntu also but maybe someone can shed light on above error: is it my hardware not setup correctly or anything I am missing. Thanks, Regards Niall Byrne ESS Test Engineering [cid:image001.png@01CE9342.6D040E30] 1625 S. Fordham St, Suite 400, Longmont, CO 80503 T: + 1-303-827-0201 extension 7-0201 Nia...@Sa...<mailto:Nia...@Sa...> PLEASE NOTE: The information contained in this electronic mail message is intended only for the use of the designated recipient(s) named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender by telephone or e-mail (as shown above) immediately and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). |
From: Niall B. <Nia...@sa...> - 2016-04-13 19:28:20
|
Hi there Trying to communicate with CSK EZT-570i environmental chamber using MinimalModbus via Null modem cable connected to a RS-232 to USB adapter to my laptop. However I keep getting IOError: No communication with the instrument (no answer) even see this with the Null modem cable disconnected. I installed MinimalModbus on a Windows 7 laptop, I was going to try it on Ubuntu also but maybe someone can shed light on above error: is it my hardware not setup correctly or anything I am missing. Thanks, Regards Niall Byrne ESS Test Engineering [cid:image001.png@01CE9342.6D040E30] 1625 S. Fordham St, Suite 400, Longmont, CO 80503 T: + 1-303-827-0201 extension 7-0201 Nia...@Sa... PLEASE NOTE: The information contained in this electronic mail message is intended only for the use of the designated recipient(s) named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender by telephone or e-mail (as shown above) immediately and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). |
From: Lloyd M. <ljt...@gm...> - 2016-03-14 19:57:47
|
Hi so i am trying to communicate with some modes devices and i keeping getting the following error. any ideas? thanks Lloyd ## Diagnostic output from minimalmodbus ## Minimalmodbus version: 0.7 Minimalmodbus status: Beta File name (with relative path): /usr/local/lib/python2.7/dist-packages/minimalmodbus.pyc Full file path: /usr/local/lib/python2.7/dist-packages/minimalmodbus.pyc pySerial version: 2.6 pySerial full file path: /usr/lib/python2.7/dist-packages/serial/__init__.pyc Platform: linux2 Filesystem encoding: 'UTF-8' Byteorder: little Python version: 2.7.9 (default, Mar 8 2015, 00:52:26) [GCC 4.9.2] Python version info: sys.version_info(major=2, minor=7, micro=9, releaselevel='final', serial=0) Python flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, unicode=0, bytes_warning=0, hash_randomization=0) Python argv: ['test7.py'] Python prefix: '/usr' Python exec prefix: '/usr' Python executable: '/usr/bin/python' Long info: sys.long_info(bits_per_digit=15, sizeof_digit=2) Float repr style: 'short' Variable __name__: minimalmodbus Current directory: /home/pi/mod Python path: /home/pi/mod /usr/local/lib/python2.7/dist-packages/pymodbus-1.3.0-py2.7.egg /usr/local/lib/python2.7/dist-packages/Twisted-15.5.0-py2.7-linux-armv7l.egg /usr/local/lib/python2.7/dist-packages/zope.interface-4.1.3-py2.7-linux-armv7l.egg /usr/lib/python2.7/dist-packages /usr/lib/python2.7 /usr/lib/python2.7/plat-arm-linux-gnueabihf /usr/lib/python2.7/lib-tk /usr/lib/python2.7/lib-old /usr/lib/python2.7/lib-dynload /usr/local/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages/gtk-2.0 /usr/lib/pymodules/python2.7 ## End of diagnostic output ## MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\n\x03\x00\x01\x00\x01\xd4\xb1' (0A 03 00 01 00 01 D4 B1) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1457985336113.3 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\n\xa0\x01\xe8\x02' (0A A0 01 E8 02) (5 bytes), roundtrip time: 1478.0 ms. Timeout setting: 1000.0 ms. Traceback (most recent call last): File "test7.py", line 8, in <module> print instrument.read_register(1, 1) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 258, in read_register return self._genericCommand(functioncode, registeraddress, numberOfDecimals=numberOfDecimals, signed=signed) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 697, in _genericCommand payloadFromSlave = self._performCommand(functioncode, payloadToSlave) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 798, in _performCommand payloadFromSlave = _extractPayload(response, self.address, self.mode, functioncode) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 1092, in _extractPayload receivedFunctioncode, functioncode, response)) ValueError: Wrong functioncode: 160 instead of 3. The response is: '\n\xa0\x01\xe8\x02' |
From: Jonas B. <jon...@ho...> - 2015-12-13 11:47:39
|
Best Patrice! Sorry for the delay in the answer. Some manufacturers use the first digit to indicate what kind of register it is. See to this page: http://www.csimn.com/CSI_pages/Modbus101.html Your address 302001 is actually an input register with address 2001 (dec). I will try to update the documentation on this in future releases. Best regards Jonas <-----Ursprungligt Meddelande-----> From: patrice examesure [pat...@ex...] Sent: 7/11/2015 6:54:51 AM To: min...@li... Subject: [Minimalmodbus-list] register adress over 65535 Hi, How to read or write register which have address over 65535, for example 302001 in my case (YOKOGAWA recorder)? Regards Patrice ------------------------------------------------------------------------ ------ _______________________________________________ Minimalmodbus-list mailing list Min...@li... https://lists.sourceforge.net/lists/listinfo/minimalmodbus-list . |
From: Jonas B. <jon...@ho...> - 2015-12-13 11:33:49
|
Hi Cameron! I think the "checksum errors" are the key to resolving the mystery. This section indicates that slave 3 is responding instead of slave 2 (see first byte in the request and response): MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 19.4 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x02-=9\x02' (03 02 02 2D 3D 39 02) (7 bytes), roundtrip time: 33.8 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '9\x02' instead of '\x1cù' . The response is: '\x03\x02\x02-=9\x02' (plain response: '\x03\x02\x02-=9\x02') >From your code: instrument[0].read_register(0) I guess that you have more than one instrument? Try running with one instrument only, and see if it helps. Minimalmodbus just sends out the string of bytes "Writing to instrument" and parses the "Response from instrument" part. I strongly suggest that you try to manually decode the messages to find the problem. It is described here: https://minimalmodbus.readthedocs.org/en/master/modbusdetails.html#modbu s-implementation-details <http://https://minimalmodbus.readthedocs.org/en/master/modbusdetails.ht ml#modbus-implementation-details> https://minimalmodbus.readthedocs.org/en/master/debugmode.html#example <http://https://minimalmodbus.readthedocs.org/en/master/debugmode.html#e xample> Try lowering the baud rate, check termination etc. See https://minimalmodbus.readthedocs.org/en/master/troubleshooting.html <http://https://minimalmodbus.readthedocs.org/en/master/troubleshooting. html> Best regards Jonas <-----Ursprungligt Meddelande-----> From: Cameron Burnett [cam...@en...] Sent: 13/11/2015 4:41:46 AM To: min...@li... Subject: [Minimalmodbus-list] Wrong values Hi, I've got a Modbus connection to one device which I'm querying with 2 commands. Setup is standard except 9600 baud.. instrument = minimalmodbus.Instrument('/dev/ttyUSB1', 2) instrument.serial.baudrate = 9600 It all works ok in terms of connecting and getting data but I'm not seeing the output as I should. Example: Modbus IO Error Modbus IO Error 518 240 518 518 518 240 518 240 518 240 518 240 Here it throws an IOError for each of the 2 commands, then proceeds to print what SHOULD be 240 and 518 alternating. What I'm getting is clearly not that as I've got some 518's in a row. This is the code that I'm running. try: humidity = instrument[0].read_register(0) print(humidity) except IOError: print("Modbus IO Error") except Exception as e: print(e) try: temperature = instrument[0].read_register(1) print(temperature) except IOError: print("Modbus IO Error") except Exception as e: print(e) What is actually happening is that I'm getting a 518 appear in the print statement for the 240 part. Any ideas on how to get around that?? Diagnostics.. ## Diagnostic output from minimalmodbus ## Minimalmodbus version: 0.7 Minimalmodbus status: Beta File name (with relative path): /usr/local/lib/python3.2/dist-packages/minimalmodbus.py Full file path: /usr/local/lib/python3.2/dist-packages/minimalmodbus.py pySerial version: 2.5 pySerial full file path: /usr/lib/python3/dist-packages/serial/__init__.py Platform: linux2 Filesystem encoding: 'utf-8' Byteorder: little Python version: 3.2.3 (default, Mar 1 2013, 11:53:50) [GCC 4.6.3] Python version info: sys.version_info(major=3, minor=2, micro=3, releaselevel='final', serial=0) Python flags: sys.flags(debug=0, division_warning=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=0) Python argv: ['/root/batterymonitor/main.py'] Python prefix: '/usr' Python exec prefix: '/usr' Python executable: '/usr/bin/python3' Long info: (none) Float repr style: 'short' Variable __name__: minimalmodbus Current directory: /root/batterymonitor Python path: /root/batterymonitor /usr/local/lib/python3.2/dist-packages/setuptools-5.7-py3.2.egg /usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg /root/batterymonitor /usr/lib/python3.2 /usr/lib/python3.2/plat-linux2 /usr/lib/python3.2/lib-dynload /usr/local/lib/python3.2/dist-packages /usr/lib/python3/dist-packages ## End of diagnostic output ## And also when I run it in debug mode I've got slightly different issues, presumably due to timing, where the receive packets become offset. Here I get 2 IO errors where nothing is received, then I get 2 correct responses, then it all gets messy. MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1447384788789.5 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '' () (0 bytes), roundtrip time: 50.9 ms. Timeout setting: 50.0 ms. Modbus IO Error MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 13.7 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '' () (0 bytes), roundtrip time: 50.8 ms. Timeout setting: 50.0 ms. Modbus IO Error MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1018.2 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x02\x03\x02\x02-=9' (02 03 02 02 2D 3D 39) (7 bytes), roundtrip time: 0.9 ms. Timeout setting: 50.0 ms. 557 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 22.4 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x02\x03\x02\x00ó¼\x01' (02 03 02 00 F3 BC 01) (7 bytes), roundtrip time: 0.8 ms. Timeout setting: 50.0 ms. 243 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1023.6 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x02\x03\x02\x02íÿ\x02' (02 03 02 02 ED FF 02) (7 bytes), roundtrip time: 30.6 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: 'ÿ\x02' instead of '=i' . The response is: '\x02\x03\x02\x02íÿ\x02' (plain response: '\x02\x03\x02\x02íÿ\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 19.4 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x02-=9\x02' (03 02 02 2D 3D 39 02) (7 bytes), roundtrip time: 33.8 ms. Timeout setting: 50.0 ms. === message truncated === |
From: Jonas B. <jon...@ho...> - 2015-12-13 11:03:47
|
Hi! Please try to send more information on the device you are trying to talk to. A PDF manual would be helpful. In general it is rather easy to adapt minimalmodbus to your needs. See: https://minimalmodbus.readthedocs.org/en/master/develop.html#extending-m inimalmodbus <http://https://minimalmodbus.readthedocs.org/en/master/develop.html#ext ending-minimalmodbus> Best regards Jonas <mailto:minimalmodbus-list%40lists.sourceforge.net> <-----Ursprungligt Meddelande-----> From: Alper Kunt [alp...@gm...] Sent: 7/12/2015 3:04:10 AM To: py...@us... Subject: Help Needed - Minimalmodbus 0.7 Hello Jonas, First of all Thank you for your hard and perfect effort to help others. Your system works perfectly fine with common modbus devices. I use it always. It is my first choice. What i am trying to ask is, i had a new device to communicate. This device says :(RTU) 4d should be added as prefix and 42 should be added as suffix to writing registers. The answer will be the same format "4d -------- 42" Is there any easy way to do this? Best Regards, -- Cheers Alper Kunt |
From: Ravi R. <sag...@gm...> - 2015-11-22 13:35:50
|
Hi, How can we add delay after performing writing & reading register . -RR |
From: Cameron B. <cam...@en...> - 2015-11-13 04:02:30
|
Hi, Ive got a Modbus connection to one device which Im querying with 2 commands. Setup is standard except 9600 baud . instrument = minimalmodbus.Instrument('/dev/ttyUSB1', 2) instrument.serial.baudrate = 9600 It all works ok in terms of connecting and getting data but Im not seeing the output as I should. Example: Modbus IO Error Modbus IO Error 518 240 518 518 518 240 518 240 518 240 518 240 Here it throws an IOError for each of the 2 commands, then proceeds to print what SHOULD be 240 and 518 alternating. What Im getting is clearly not that as Ive got some 518s in a row. This is the code that Im running try: humidity = instrument[0].read_register(0) print(humidity) except IOError: print("Modbus IO Error") except Exception as e: print(e) try: temperature = instrument[0].read_register(1) print(temperature) except IOError: print("Modbus IO Error") except Exception as e: print(e) What is actually happening is that Im getting a 518 appear in the print statement for the 240 part. Any ideas on how to get around that?? Diagnostics . ## Diagnostic output from minimalmodbus ## Minimalmodbus version: 0.7 Minimalmodbus status: Beta File name (with relative path): /usr/local/lib/python3.2/dist-packages/minimalmodbus.py Full file path: /usr/local/lib/python3.2/dist-packages/minimalmodbus.py pySerial version: 2.5 pySerial full file path: /usr/lib/python3/dist-packages/serial/__init__.py Platform: linux2 Filesystem encoding: 'utf-8' Byteorder: little Python version: 3.2.3 (default, Mar 1 2013, 11:53:50) [GCC 4.6.3] Python version info: sys.version_info(major=3, minor=2, micro=3, releaselevel='final', serial=0) Python flags: sys.flags(debug=0, division_warning=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=0) Python argv: ['/root/batterymonitor/main.py'] Python prefix: '/usr' Python exec prefix: '/usr' Python executable: '/usr/bin/python3' Long info: (none) Float repr style: 'short' Variable __name__: minimalmodbus Current directory: /root/batterymonitor Python path: /root/batterymonitor /usr/local/lib/python3.2/dist-packages/setuptools-5.7-py3.2.egg /usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg /root/batterymonitor /usr/lib/python3.2 /usr/lib/python3.2/plat-linux2 /usr/lib/python3.2/lib-dynload /usr/local/lib/python3.2/dist-packages /usr/lib/python3/dist-packages ## End of diagnostic output ## And also when I run it in debug mode Ive got slightly different issues, presumably due to timing, where the receive packets become offset. Here I get 2 IO errors where nothing is received, then I get 2 correct responses, then it all gets messy. MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1447384788789.5 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '' () (0 bytes), roundtrip time: 50.9 ms. Timeout setting: 50.0 ms. Modbus IO Error MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 13.7 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '' () (0 bytes), roundtrip time: 50.8 ms. Timeout setting: 50.0 ms. Modbus IO Error MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1018.2 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x02\x03\x02\x02-=9' (02 03 02 02 2D 3D 39) (7 bytes), roundtrip time: 0.9 ms. Timeout setting: 50.0 ms. 557 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 22.4 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x02\x03\x02\x00ó¼\x01' (02 03 02 00 F3 BC 01) (7 bytes), roundtrip time: 0.8 ms. Timeout setting: 50.0 ms. 243 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1023.6 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x02\x03\x02\x02íÿ\x02' (02 03 02 02 ED FF 02) (7 bytes), roundtrip time: 30.6 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: 'ÿ\x02' instead of '=i' . The response is: '\x02\x03\x02\x02íÿ\x02' (plain response: '\x02\x03\x02\x02íÿ\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 19.4 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x02-=9\x02' (03 02 02 2D 3D 39 02) (7 bytes), roundtrip time: 33.8 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '9\x02' instead of '\x1cù' . The response is: '\x03\x02\x02-=9\x02' (plain response: '\x03\x02\x02-=9\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1021.5 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x00ó¼\x01\x02' (03 02 00 F3 BC 01 02) (7 bytes), roundtrip time: 31.9 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '\x01\x02' instead of '$ù' . The response is: '\x03\x02\x00ó¼\x01\x02' (plain response: '\x03\x02\x00ó¼\x01\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 34.5 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x02-=9\x02' (03 02 02 2D 3D 39 02) (7 bytes), roundtrip time: 33.8 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '9\x02' instead of '\x1cù' . The response is: '\x03\x02\x02-=9\x02' (plain response: '\x03\x02\x02-=9\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1026.4 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x00ó¼\x01\x02' (03 02 00 F3 BC 01 02) (7 bytes), roundtrip time: 32.1 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '\x01\x02' instead of '$ù' . The response is: '\x03\x02\x00ó¼\x01\x02' (plain response: '\x03\x02\x00ó¼\x01\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 35.4 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x02-=9\x02' (03 02 02 2D 3D 39 02) (7 bytes), roundtrip time: 32.8 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '9\x02' instead of '\x1cù' . The response is: '\x03\x02\x02-=9\x02' (plain response: '\x03\x02\x02-=9\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1020.3 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x00ó¼\x01\x02' (03 02 00 F3 BC 01 02) (7 bytes), roundtrip time: 31.2 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '\x01\x02' instead of '$ù' . The response is: '\x03\x02\x00ó¼\x01\x02' (plain response: '\x03\x02\x00ó¼\x01\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 21.2 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x02-=9\x02' (03 02 02 2D 3D 39 02) (7 bytes), roundtrip time: 32.4 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '9\x02' instead of '\x1cù' . The response is: '\x03\x02\x02-=9\x02' (plain response: '\x03\x02\x02-=9\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1020.5 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x00ó¼\x01\x02' (03 02 00 F3 BC 01 02) (7 bytes), roundtrip time: 31.3 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '\x01\x02' instead of '$ù' . The response is: '\x03\x02\x00ó¼\x01\x02' (plain response: '\x03\x02\x00ó¼\x01\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 21.5 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x02-=9\x02' (03 02 02 2D 3D 39 02) (7 bytes), roundtrip time: 31.4 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '9\x02' instead of '\x1cù' . The response is: '\x03\x02\x02-=9\x02' (plain response: '\x03\x02\x02-=9\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x00\x00\x01\x849' (02 03 00 00 00 01 84 39) MinimalModbus debug mode. No sleep required before write. Time since previous read: 1021.1 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x00ó¼\x01\x02' (03 02 00 F3 BC 01 02) (7 bytes), roundtrip time: 32.1 ms. Timeout setting: 50.0 ms. Checksum error in rtu mode: '\x01\x02' instead of '$ù' . The response is: '\x03\x02\x00ó¼\x01\x02' (plain response: '\x03\x02\x00ó¼\x01\x02') MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x02\x03\x00\x01\x00\x01Õù' (02 03 00 01 00 01 D5 F9) MinimalModbus debug mode. No sleep required before write. Time since previous read: 21.1 ms, minimum silent period: 4.01 ms. MinimalModbus debug mode. Response from instrument: '\x03\x02\x02-=9\x02' (03 02 02 2D 3D 39 02) (7 bytes), roundtrip time: 31.0 ms. Timeout setting: 50.0 ms. Thanks, Cameron. |
From: patrice e. <pat...@ex...> - 2015-11-07 06:32:21
|
Hi, How to read or write register which have address over 65535, for example 302001 in my case (YOKOGAWA recorder)? Regards Patrice |
From: Jonas B. <jon...@ho...> - 2015-07-28 22:26:28
|
Hi Tony! Please try using the debug mode, to see what is causing the delay. See http://minimalmodbus.sourceforge.net/#debug-mode Best regards Jonas <-----Ursprungligt Meddelande-----> From: Tony Graham [ton...@sp...] Sent: 28/7/2015 2:18:17 PM To: min...@li... Subject: [Minimalmodbus-list] MinimalModbus Question Hello, I am working on a small data collection system using a velocio plc and minimalmodbus. My question is that it seems to be taking about 10 seconds to read an updated reading on the register. The register is a counter that ticks every second. When I use modbus_tk it does continually update when I call the read commad but I do not like the way modbus_tk returns the register values so I would prefer to get minimal modbus working a little better. The following is my sample code and the output is exactly what the register is reading. I compared it to the live output of the plc in velocio's software. Import minimalmodbus plc = minimalmodbus.Instrument('COM3', 1) plc.minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL = True # I have tried both ways plc.serial.baudrate = 115200 downtime = plc.read_long(6,2) #modbus address 6 in the plc stored as an unsigned INT32 print downtime output is dead on! However, if I keep calling the last two lines from the python command line ( call downtime = the print downtime) constantly every second it takes about 10 seconds for a new value to appear. I have also put this in a module and called the module, get a value, close the command line, start python and import the module again. I can do this process repeatedly and the process takes about 10 seconds for a new value to be returned. The new value is correct though. I have used python27 and python34 and tried on win 7 and win 8.1. Modbus_tk will update every second so I know it is not the plc. Any imput would be great as I love the simplicity of minimal modbus. Tony Graham |
From: Tony G. <ton...@sp...> - 2015-07-28 12:31:20
|
Hello, I am working on a small data collection system using a velocio plc and minimalmodbus. My question is that it seems to be taking about 10 seconds to read an updated reading on the register. The register is a counter that ticks every second. When I use modbus_tk it does continually update when I call the read commad but I do not like the way modbus_tk returns the register values so I would prefer to get minimal modbus working a little better. The following is my sample code and the output is exactly what the register is reading. I compared it to the live output of the plc in velocio's software. Import minimalmodbus plc = minimalmodbus.Instrument('COM3', 1) plc.minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL = True # I have tried both ways plc.serial.baudrate = 115200 downtime = plc.read_long(6,2) #modbus address 6 in the plc stored as an unsigned INT32 print downtime output is dead on! However, if I keep calling the last two lines from the python command line ( call downtime = the print downtime) constantly every second it takes about 10 seconds for a new value to appear. I have also put this in a module and called the module, get a value, close the command line, start python and import the module again. I can do this process repeatedly and the process takes about 10 seconds for a new value to be returned. The new value is correct though. I have used python27 and python34 and tried on win 7 and win 8.1. Modbus_tk will update every second so I know it is not the plc. Any imput would be great as I love the simplicity of minimal modbus. Tony Graham |
From: Olivier M. <om...@re...> - 2015-05-25 11:34:09
|
Hi, Thanks, I didn't know the exception in pyhton.. Thanks for all! Olivier Maïly Programmation & Support France [header_logo] 1600, 55ème Avenue Lachine (Québec) H8T 3J5 Tél. : +1 514 636-2878, poste 1621 Cell. : +1 514 206-8242 Tél. Fr : +33 970 405 490 www.regulvar.com<http://www.regulvar.com/> Ce courriel est confidentiel. Si vous l'avez reçu par erreur, veuillez nous en informer et le supprimer. Il est interdit à toute personne autre que le destinataire visé d'utiliser, copier ou diffuser ce message. | This email is confidential. If you have received it in error, please delete it and notify us. Any person other than the intended recipient is strictly prohibited from using, copying or distributing this message. De : Jonas Berg [mailto:jon...@ho...] Envoyé : 25 mai 2015 06:48 À : Olivier Maily Cc : min...@li... Objet : Re: [Minimalmodbus-list] Timeout Errors Best Olivier! You can do something like: number_of_errors=0 while True: try: pc_hiver=m.read_register(82,0) except: print"Failed to read data" # For python2. Use print("Failed...") for Python3 number_of_errors += 1 etc Best regards Jonas <-----Ursprungligt Meddelande-----> From: Olivier Maily [om...@re...] Sent: 20/5/2015 9:45:14 PM To: min...@li...<mailto:min...@li...> Subject: [Minimalmodbus-list] Timeout Errors Hi On a modbus equipment, I need to communicate without interruption, so I did a While 1 : Instrument.read_register(82,0) Etc My problem is that sometimes I have a intempestive timeout error and go out of my program. I would like to know if have a possibility to ignore or to count the timeout error. I am starting on pyhton and minimal modbus. Regards, My script #!/usr/bin/env python import minimalmodbus minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL=True import time m=minimalmodbus.Instrument('/dev/ttyAMA0',1) m.serial.baudrate =38400 m.serial.stopbits =2 m.serial.timeout=0.250 m.debug=True compteur=0 while 1: compteur+=1 pc_hiver=m.read_register(82,0) print compteur The debug of my script 105 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.5 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 106 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 107 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.8 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 108 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.4 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 109 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.7 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 110 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 111 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.0 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.6 ms. Timeout setting: 250.0 ms. 112 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '' (0 bytes), roundtrip time: 250.8 ms. Timeout setting: 250.0 ms. Traceback (most recent call last): File "essai.py", line 52, in <module> pc_hiver=m.read_register(82,0) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 254, in read_register return self._genericCommand(functioncode, registeraddress, numberOfDecimals=numberOfDecimals, signed=signed) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 693, in _genericCommand payloadFromSlave = self._performCommand(functioncode, payloadToSlave) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 791, in _performCommand response = self._communicate(message, number_of_bytes_to_read) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 909, in _communicate raise IOError('No communication with the instrument (no answer)') IOError: No communication with the instrument (no answer) === message truncated === |
From: Jonas B. <jon...@ho...> - 2015-05-25 10:48:41
|
Best Olivier! You can do something like: number_of_errors=0 while True: try: pc_hiver=m.read_register(82,0) except: print"Failed to read data" # For python2. Use print("Failed...") for Python3 number_of_errors += 1 etc Best regards Jonas <-----Ursprungligt Meddelande-----> From: Olivier Maily [om...@re...] Sent: 20/5/2015 9:45:14 PM To: min...@li... Subject: [Minimalmodbus-list] Timeout Errors Hi On a modbus equipment, I need to communicate without interruption, so I did a While 1 : Instrument.read_register(82,0) Etc My problem is that sometimes I have a intempestive timeout error and go out of my program. I would like to know if have a possibility to ignore or to count the timeout error. I am starting on pyhton and minimal modbus. Regards, My script #!/usr/bin/env python import minimalmodbus minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL=True import time m=minimalmodbus.Instrument('/dev/ttyAMA0',1) m.serial.baudrate =38400 m.serial.stopbits =2 m.serial.timeout=0.250 m.debug=True compteur=0 while 1: compteur+=1 pc_hiver=m.read_register(82,0) print compteur The debug of my script 105 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.5 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 106 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 107 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.8 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 108 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.4 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 109 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.7 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 110 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 111 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.0 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.6 ms. Timeout setting: 250.0 ms. 112 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '' (0 bytes), roundtrip time: 250.8 ms. Timeout setting: 250.0 ms. Traceback (most recent call last): File "essai.py", line 52, in <module> pc_hiver=m.read_register(82,0) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 254, in read_register return self._genericCommand(functioncode, registeraddress, numberOfDecimals=numberOfDecimals, signed=signed) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 693, in _genericCommand payloadFromSlave = self._performCommand(functioncode, payloadToSlave) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 791, in _performCommand response = self._communicate(message, number_of_bytes_to_read) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 909, in _communicate raise IOError('No communication with the instrument (no answer)') IOError: No communication with the instrument (no answer) === message truncated === |
From: Olivier M. <om...@re...> - 2015-05-21 15:11:46
|
Hi On a modbus equipment, I need to communicate without interruption, so I did a While 1 : Instrument.read_register(82,0) Etc My problem is that sometimes I have an intempestive timeout error and go out of my program. I try to put more time of timeout (30s) but it's not working. I think that the equipment is not listening on his modbus port so he doesnt listen the questions and doesn't give an answer... I would like to know if have a possibility to ignore or to count the timeout error. For example if have ten timeout consecutive errors I stop the code. I am starting on pyhton and minimal modbus. Regards, My script #!/usr/bin/env python import minimalmodbus minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL=True import time m=minimalmodbus.Instrument('/dev/ttyAMA0',1) m.serial.baudrate =38400 m.serial.stopbits =2 m.serial.timeout=0.250 m.debug=True compteur=0 while 1: compteur+=1 pc_hiver=m.read_register(82,0) print compteur The debug of my script 105 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.5 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 106 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 107 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.8 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 108 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.4 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 109 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.7 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 110 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 111 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.0 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.6 ms. Timeout setting: 250.0 ms. 112 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '' (0 bytes), roundtrip time: 250.8 ms. Timeout setting: 250.0 ms. Traceback (most recent call last): File "essai.py", line 52, in <module> pc_hiver=m.read_register(82,0) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 254, in read_register return self._genericCommand(functioncode, registeraddress, numberOfDecimals=numberOfDecimals, signed=signed) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 693, in _genericCommand payloadFromSlave = self._performCommand(functioncode, payloadToSlave) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 791, in _performCommand response = self._communicate(message, number_of_bytes_to_read) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 909, in _communicate raise IOError('No communication with the instrument (no answer)') IOError: No communication with the instrument (no answer) Olivier Maïly Programmation & Support France [header_logo] 1600, 55ème Avenue Lachine (Québec) H8T 3J5 Tél. : +1 514 636-2878, poste 1621 Cell. : +1 514 206-8242 Tél. Fr : +33 970 405 490 www.regulvar.com<http://www.regulvar.com/> Ce courriel est confidentiel. Si vous l'avez reçu par erreur, veuillez nous en informer et le supprimer. Il est interdit à toute personne autre que le destinataire visé d'utiliser, copier ou diffuser ce message. | This email is confidential. If you have received it in error, please delete it and notify us. Any person other than the intended recipient is strictly prohibited from using, copying or distributing this message. |
From: Olivier M. <om...@re...> - 2015-05-20 19:58:38
|
Hi On a modbus equipment, I need to communicate without interruption, so I did a While 1 : Instrument.read_register(82,0) Etc My problem is that sometimes I have a intempestive timeout error and go out of my program. I would like to know if have a possibility to ignore or to count the timeout error. I am starting on pyhton and minimal modbus. Regards, My script #!/usr/bin/env python import minimalmodbus minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL=True import time m=minimalmodbus.Instrument('/dev/ttyAMA0',1) m.serial.baudrate =38400 m.serial.stopbits =2 m.serial.timeout=0.250 m.debug=True compteur=0 while 1: compteur+=1 pc_hiver=m.read_register(82,0) print compteur The debug of my script 105 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.5 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 106 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 107 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.8 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 108 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.4 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 109 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.7 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.4 ms. Timeout setting: 250.0 ms. 110 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.3 ms. Timeout setting: 250.0 ms. 111 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.0 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '\x01\x03\x02\n(\xbe\xfa' (7 bytes), roundtrip time: 6.6 ms. Timeout setting: 250.0 ms. 112 MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x00R\x00\x01%\xdb' MinimalModbus debug mode. No sleep required before write. Time since previous read: 33.1 ms, minimum silent period: 1.00 ms. MinimalModbus debug mode. Response from instrument: '' (0 bytes), roundtrip time: 250.8 ms. Timeout setting: 250.0 ms. Traceback (most recent call last): File "essai.py", line 52, in <module> pc_hiver=m.read_register(82,0) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 254, in read_register return self._genericCommand(functioncode, registeraddress, numberOfDecimals=numberOfDecimals, signed=signed) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 693, in _genericCommand payloadFromSlave = self._performCommand(functioncode, payloadToSlave) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 791, in _performCommand response = self._communicate(message, number_of_bytes_to_read) File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 909, in _communicate raise IOError('No communication with the instrument (no answer)') IOError: No communication with the instrument (no answer) Olivier Maïly Programmation & Support France [header_logo] 1600, 55ème Avenue Lachine (Québec) H8T 3J5 Tél. : +1 514 636-2878, poste 1621 Cell. : +1 514 206-8242 Tél. Fr : +33 970 405 490 www.regulvar.com<http://www.regulvar.com/> Ce courriel est confidentiel. Si vous l'avez reçu par erreur, veuillez nous en informer et le supprimer. Il est interdit à toute personne autre que le destinataire visé d'utiliser, copier ou diffuser ce message. | This email is confidential. If you have received it in error, please delete it and notify us. Any person other than the intended recipient is strictly prohibited from using, copying or distributing this message. |
From: Jonas B. <jon...@ho...> - 2015-05-06 22:16:40
|
Best Aron! I agree that the CRC should be '\xd5\xca'. You can test yourself using minimalmodbus: Python 2.7.3 (default, Feb 27 2014, 20:00:17) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import minimalmodbus >>> minimalmodbus._calculateCrcString("\x01\x03\x00\x01\x00\x01") '\xd5\xca' Please run MinimalModbus in debug mode, and paste a printout what is actually sent and received. Also attach the relevant section of your code. Then we will be able to solve the mystery! Best regards Jonas <-----Ursprungligt Meddelande-----> From: Áron Molnár [mol...@gm...] Sent: 28/4/2015 11:41:12 PM To: min...@li... Subject: [Minimalmodbus-list] minimalmodbus incorrect CRC? Dear minimalmodbus team! Im about to design a home control system: the brain is a RaspberryPi V1 ModelB, using modbus, the slaves are PIC16F887 chips. In the future all devices will use RS485 on CAT5 wires, but for now direct connection from PiTx-to PICRx.. At the moment I stucked by using minimalmodbus: The communication works properly, everything I send from the Pi is arriving to the receive buffer of the uController ( I can see all the buffer entrys in debug mode in MPLAB)! Currently its only one way communication, so no respond from the PIC, the Pi's RX wire is not installed because of the 5V-3.3V issue...The PIC is happy with the 3.3V signal) The problem is, that after sending 8 characters /for example: read_register(x,y)/ the first 6 bytes of the 8 are arriving properly. the 7th and the 8th are arriving as well these should contain the CRC_high and CRC_low bytes! There is something arriving in the 7th and 8th, so not empty buffer entrys but the content is incorrect! For example after receiving a modbus message from the Pi -> the first 6 bytes: 0x01\0x03\0x00\0x01\0x00\0x01 then the crc is 0xA5\0x9A! This is incorrect, this should be 0xD5\0xCA! I tried two different method of CRC calculation: - lookup table as it is in the project https://github.com/danjperron/NoContact ... er/CRC16.c <https://github.com/danjperron/NoContactWaterDetect/blob/master/CRC16.c> - cyclic calculation as in the project https://github.com/EmbeddedSam/Modbus-S ... r/modbus.c <https://github.com/EmbeddedSam/Modbus-Slave-for-PIC18F/blob/master/modb us.c> - PLUS just to make sure I also checked by using online excel tool at http://www.simplymodbus.ca/crc.xls The result is always 0xD5\0xCA! I have to say: considering the fact that the first bytes are arriving without any problem, the communication is OK. The problem should be in the minimalmodbus SW in the Pi! The way to calculate CRC is not OK, or not CRC16... Is there any configuration in minimalmodbus, or any setting or anything I was not aware of? Is there anything can solve this problem? Many thanks in advance! Best Regards, BlueSquirrel Here is the result of the minimalmodbus._getDiagnosticString(): ## Diagnostic output from minimalmodbus ## Minimalmodbus version: 0.6 Minimalmodbus status: Beta Revision: $Rev: 200 $ Revision date: $Date: 2014-06-22 01:29:19 0200 (Sun, 22 Jun 2014) $ File name (with relative path): /usr/local/lib/python2.7/dist-packages/minimalmodbus.pyc Full file path: /usr/local/lib/python2.7/dist-packages/minimalmodbus.pyc pySerial version: 2.7 pySerial full file path: /usr/local/lib/python2.7/dist-packages/serial/__init__.pyc Platform: linux2 Filesystem encoding: 'UTF-8' Byteorder: little Python version: 2.7.3 (default, Mar 18 2014, 05:13:23) [GCC 4.6.3] Python version info: sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0) Python flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, unicode=0, bytes_warning=0, hash_randomization=0) Python argv: [''] Python prefix: '/usr' Python exec prefix: '/usr' Python executable: '/usr/bin/python' Long info: sys.long_info(bits_per_digit=15, sizeof_digit=2) Float repr style: 'short' Variable __name__: minimalmodbus Current directory: /home/pi Python path: /usr/lib/python2.7 /usr/lib/python2.7/plat-linux2 /usr/lib/python2.7/lib-tk === message truncated === |