Jump to content

[LVTN] Plasmionique Modbus Master


Recommended Posts

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.

Link to comment
  • 2 weeks later...
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!

Link to comment

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.

Link to comment
  • 11 months later...

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    

Link to comment

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

Link to comment
  • 1 month later...

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.

  • Like 1
Link to comment
  • 2 months later...

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 by ensegre
  • Like 1
Link to comment
  • 3 weeks later...
  • 2 weeks later...
  • 3 weeks later...

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!

MB Library.PNG

Link to comment
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 by Porter
Link to comment
  • 2 months later...

@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.

Link to comment
  • 5 months later...

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.

 

 

Link to comment

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?

Link to comment
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

Link to comment

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.

Link to comment
  • 2 months later...

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 by Masony
  • Like 1
Link to comment
  • 4 weeks later...
  • 3 weeks later...
On 6/27/2019 at 10:33 AM, Porter said:

@Masony, something like this?

Capture.PNG

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.