ASalcedo 0 Report post Posted February 3, 2017 18 hours ago, Porter said: For #3, check the "MB_Master Simple Serial.vi" example located in "<LabVIEW>\examples\Plasmionique\MB Master\" or search for it in the Example Finder. Thanks a lot. I am gonna check what you said and I will post here the solution if I fix it. Thanks again. Quote Share this post Link to post Share on other sites
ASalcedo 0 Report post Posted February 13, 2017 On 2/2/2017 at 5:57 PM, Porter said: For #3, check the "MB_Master Simple Serial.vi" example located in "<LabVIEW>\examples\Plasmionique\MB Master\" or search for it in the Example Finder. Yes! That simple!! Thanks!! I have another question. In my application I have to read constantly a few variables from PLC (coils, registers...). For example if a coil is 1, then an event occurs in my application (in an event structure). Sometimes as I said in #1 some variables are not read. So what is the best way to do a poll? Just one while reading every variables (coils and registers) each 10ms for example and then pass the information in local variables to anothers whiles? Thanks a lot! Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted February 16, 2017 10ms seems like a very short polling period for a serial device. 100ms is more realistic. Of course it depends on baud rate, number of transactions, FIFO buffer settings etc... But yes, you can just poll the PLC in one loop (as shown in the simple serial example), then put the data into a queue or user event to pass it to other loops. I would recommend looking into the producer/consumer design pattern. Quote Share this post Link to post Share on other sites
IBB 0 Report post Posted February 14, 2018 Hi, I am have a issue with this library. I will try to setup a modbus TCP Master and start communication with a slave device which uses a MBAP header. Is it possible to use this library for these application and how implementing it? Every try to start a communication stops with an error message Many thanks in advance Ingo Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted February 14, 2018 The Modbus TCP Master uses the MBAP header. I will need more information in order to help you. What error message is produced when communication stops? Please post example code that reproduces the error. Please try the attached code. Fill in the correct IP address, port number, slave ID, holding register address before running it. Post a screenshot of the output MB TCP Read Holding Register Test.vi Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted March 21, 2018 This project is now available on GitHub: https://github.com/rfporter/Modbus-Master If you want to make modifications to the modbus master library, I suggest that you pull the source code from that repo. To build your own release, you just need to build the "Source Distribution" then build a VIP package using "MB Master.vipb" with VI Package Manager 2014. 1 Quote Share this post Link to post Share on other sites
ensegre 69 Report post Posted June 7, 2018 (edited) I was thinking, an useful addition to the cool Modbus Comm Tester would be a section for Read Device Identification. Probably fitting nicely the 7th rectangle on the FP is the difficult part of it; the extension of the code, which is elegantly written, seems trivial. What do you think about? Edited June 7, 2018 by ensegre 1 Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted June 8, 2018 I will look at adding it to the next release. I also want to add polling of holding registers and coils as an option in the Modbus Comm Tester. I also plan to properly implement transaction IDs for Modbus TCP: https://github.com/rfporter/Modbus-Master/issues/1 Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted June 26, 2018 (edited) I have implemented transaction IDs for Modbus TCP in the "Transaction ID fix" branch here: https://github.com/rfporter/Modbus-Master/tree/Transaction-ID-Fix Could use some feedback. Here is a vip if you would like to take it for a spin: mb_master-1.3.2.4.vip Edited June 26, 2018 by Porter Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted July 5, 2018 A little bit more testing and tweaking is required. Almost ready for another release though. Here is the preview: mb_master-1.3.2.7.vip Transaction IDs are randomly generated. Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted July 26, 2018 In version 1.3.2 the session valid property of the MB Master TCP class was broken. This is fixed in v1.3.3. Quote Share this post Link to post Share on other sites
Masony 1 Report post Posted August 1, 2018 Hopefully a real quick question: I just started using this library, I got referred over here from the NI forums as this Modbus Library solved an issue that another MB library I was using had. That being said, I have not really taken a dive under the hood to figured out my problem. I was curious if anyone knew a quick fix before I started looking into it. When I try to build an application through the application builder that is using this MB library I get an error telling me that it can't build a broken VI without attaching the block diagram (which does fix the issue). It pointed me towards the "Read Session Valid.vi" as the issue. When I looked at that vi I can see a broken arrow with the error pointing towards the "unbundle by name". Can anyone verify that this block diagram is correct? I double checked I had the newest version of the library and still get this issue. Thanks! Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted August 2, 2018 (edited) 5 hours ago, Masony said: When I try to build an application through the application builder that is using this MB library I get an error telling me that it can't build a broken VI without attaching the block diagram (which does fix the issue). It pointed me towards the "Read Session Valid.vi" as the issue. When I looked at that vi I can see a broken arrow with the error pointing towards the "unbundle by name". Can anyone verify that this block diagram is correct? I double checked I had the newest version of the library and still get this issue. This is fixed in the latest version (v1.3.3.1) here: Edited August 2, 2018 by Porter Quote Share this post Link to post Share on other sites
picky33 0 Report post Posted October 30, 2018 @Porter I'm trying to use Plasmionique Modbus ver 1.3.1.4 with Labview 2014 over serial and i keep running into a CRC error. it's not properly calculating the CRC. For example: The Master sends: 01 04 00 00 00 01 31 CA and the builtin simple slave responds with 01 04 00 00 00 01 31 instead of the correct message 01 04 03 00 00 B9 30 i've this with the Plasmionique Master example and with the third party Modbus Poll program. and both report a CRC error. Any help would be appriciated. Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted October 31, 2018 Plasmionique Modbus Master cannot act as a slave. NI Modbus Library contains a good slave for testing purposes: https://github.com/NISystemsEngineering/LabVIEW-Modbus-API Quote Share this post Link to post Share on other sites
picky33 0 Report post Posted October 31, 2018 Have you ever thought of creating a Slave Library? Your ablity to use visa locking to allow multiple masters to write over 1 comm port would be in valuable to doing the same to allow multiple slaves to read and write over the same serial port. Quote Share this post Link to post Share on other sites
Volker Hampel 0 Report post Posted April 2 Thanks for the easy to use Libary. As I have a combined measurement, a NI-DAQ-Device and the DUT, that sends its internal parameters via Modbus, I would like to set a sample rate for the MODBUS data and to synchronize both systems The Baudrate is at the moment at 230400, but data are flowing in with samplerate arround 1sec. Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted April 2 How much data are you transferring? For example, if you are reading 1000 input registers, one register at a time, then you can't expect to get a sample rate of 100ms. Screenshots or sample code would be useful if you are looking for help. Are you using the Modbus Comm Tester? Quote Share this post Link to post Share on other sites
Volker Hampel 0 Report post Posted April 3 13 hours ago, Porter said: How much data are you transferring? For example, if you are reading 1000 input registers, one register at a time, then you can't expect to get a sample rate of 100ms. => The maximum registers I had were about 50. I do not want to have a fast sample rate as I have slow changing processes, but I like to synchronize (have the same samplerate) the data derived from Modbus with my DAQ data. Screenshots or sample code would be useful if you are looking for help. => is attached Are you using the Modbus Comm Tester? => no I have attached the VI that I use tu read the registers. Modbus Read Waveform.vi Quote Share this post Link to post Share on other sites
ensegre 69 Report post Posted April 3 If you are reading single register values at 1Hz, sample rate doesn't look to me a limiting factor. The modbus packet size might be some 20bytes [Mike correct me], at 230kbaud they are moved through in a ms. The jitter in the synchronization, rather, might be, but that depends on what you can afford or tolerate. You have to keep in mind that both DAQ and Modbus are in principle asynchronous measurements. You can write a program which pushes a modbus command into the computer UART and a start acquisition command to the DAQ. Depending on how you write the program and on the realtiming of the target you run onto, you can approach a simultaneous firing of the commands, but still you don't know the latency of execution of them. The bottom line is normally that if you want sampling to be tightly synchronized, you have to do that by hardware triggering. In reading the results, you may afford delays. Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted April 3 7 hours ago, Volker Hampel said: I have attached the VI that I use tu read the registers. Since your input registers are contiguous, I would suggest reading all of them with one call of read input registers. See attached. Modbus Read Waveform.vi Quote Share this post Link to post Share on other sites
Masony 1 Report post Posted June 19 (edited) I just ran into an issue where a VFD with option modules would kick back "Illegal Data Address" when attempting to read/write Holding Registers. Upon discussion with the manufacturer it was found that the unit ID for the various option modules is different than the VFD itself (255). I changed the Unit ID constant in the "Create TCP Session" vi and it fixed the issue, as well as using a property node to change the Unit ID after creating the TCP Session. Would you consider changing the constant to a control with the default being 255? Keep up the great work, I use this library daily and it has been a life saver. Thanks! Edited June 19 by Masony 1 Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted June 27 @Masony, something like this? Quote Share this post Link to post Share on other sites
Porter 45 Report post Posted July 23 v1.3.5 has been released: Improved RTU CRC calculation speed Added Slave ID input to "Open TCP Session.vi" Updated documentation Quote Share this post Link to post Share on other sites
Masony 1 Report post Posted August 9 On 6/27/2019 at 10:33 AM, Porter said: @Masony, something like this? Hey, sorry about the late reply I guess email notifications weren't working. Anyways I see that you pushed out an update and that was exactly what I was thinking. Thanks so much for the quick response. Quote Share this post Link to post Share on other sites