NI Labs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

NI LabVIEW Modbus API Discussion

Hi,... I have troubles using the library in LabView 2014

when I use "Create Serial Master VI" I get this message:

Error -1073807202 occurred at Property Node (arg 1) in Serial Shared Components.lvlib:Configure Serial Port.vi->Serial Master.lvclass:Initialize Master.vi->Modbus Master.lvclass:Initialize.vi->API Main.lvlib:Create Serial Master.vi->Test1.vi

Possible reason(s):

LabVIEW:  (Hex 0xBFFF009E) VISA or a code library required by VISA could not be located or loaded.  This is usually due to a required driver not being installed on the system.

I don't know how to solve it, I can see VISA control in palette.. Is enough?

I never use serial port before in LABVIEW with VISA... But I used before at university ... long time ago, but I think I can do it if someone here help me.

Thanks

0 Kudos
Message 321 of 529
(4,542 Views)

Hey Jimkurk,

I've run into this problem before. My VISA library needed to be reinstalled because it got corrupt. Try the troubleshooting links in this guide:

http://digital.ni.com/public.nsf/allkb/10C6C0FBB8E7BD4486257850006CE8FF

0 Kudos
Message 322 of 529
(4,542 Views)

Hi

I am new in modbus communication, I have I question , I read an analog voltage using Labview and arduino, so I want to send that reading by ethernet using modbus library, it could be possible?

arduino reading.JPG

Thanks.

0 Kudos
Message 323 of 529
(4,542 Views)

hi Daniel,

I am new here, and I have un problem when I write a value to my device. I copied my .vi and error here, could you have a look and tell me what's the problem? thanks a lot.

error.jpg

0 Kudos
Message 324 of 529
(4,542 Views)

Hi Daniel,

I am trying to communicate with a ModBus device, that is connected via USB (RS-232 to USB adapter) to my computer. I installed the device with VISA and now I would try to access it with your library. Unfortunately that is not possible, since I am only allowed to use serial or TCP connections.

Is there a way I can support you in extending this functionality or is there alreay a solution for this?

Regards,

Thomas

Edit: I found a solution. My RS-232 to USB converter gives me the option to load a virtual COM port device. It is a FTDI232RL chip. Now I get "Error 56 occurred at RTU Data Unit.lvclass:Read ADU Packet.vi:5030001", where I don't know what the problem is.

0 Kudos
Message 325 of 529
(4,542 Views)

Recently I have had to poke around in some Labview code a recently departed collegue had put together. Originally, the Modbus code was on the old User Library, after speaking with him, he states that he used the new Daniel Smith API.

I have also converted my old user library and IOServer code to use this API.

However, when I look at his code he is using the Modbus functions under 'Actor Framework' pallette under 'Data Communications' pallette. Whereas I never even considered this, I don't even know a thing about 'Actor Framework', and this thread (at least the first few pages) do not mention it.

Pros / Cons?

Is this another, possibly third party, Modbus library (I am poking around in this code using LV2015, whereas it was developed in LV2013/LV2014 and I don't recall installing any third party Modbus stuff when I set up this development box.

0 Kudos
Message 326 of 529
(4,542 Views)

Hi S1ack,

  The Modbus pallet is in the Communications pallet, Actor framework is a different library and they are not related.

For the library itself there are 3 versions, the really old one that was on the comunity but that one got remove and updated. The one that you can find here in NI Labs, this library was the updated version of the library, and is the one Daniel Smith updated. The version that you have is the same library, but now it is included with LabVIEW DSC and RT.

Actor framework is a good architecture for local messaging, if you want to learn more about it the hands on is a good starting point:

https://decibel.ni.com/content/docs/DOC-23893

Best Regards

Benjamin

Benjamin C
Principal Systems Engineer // CLA // CLED
0 Kudos
Message 327 of 529
(4,542 Views)

This may have been answered previously in this thread but I'm having difficulty searching....

Is the Modbus Master.lvclass data passed by reference or by value?

If by referernce is their a lookup mechanism, possbily the VISA address that would allow looking up an already created Master class in a parallel VI (without wiring the reference to the parallel VI)

0 Kudos
Message 328 of 529
(4,542 Views)

Its by value, but most things internally are references. For example, a Modbus master has a TCP ref and a lock (to stop you from accessing the connection on multiple threads at the same time) and the master has a data model (which contains DVRs of all of the registers, coils, etc which constitute a slave). A few things are values, like which slave ID the master is talking to (handy on multi-drop serial or tcp-to-serial networks).

I generally wouldn't recommend sharing a master between parallel loops. Because modbus is a request-response protocol you can only handle a single request at a time on a given connection (hence the lock inside to prevent accidentally breaking this rule). Its also just strange to me why you'd want to talk to a single slave from multiple loops, I would normally write some sort of intermediary driver to hide how terrible modbus is from the rest of the application (ie you send your modbus loop "please set pressure to 25" and the solitary modbus loop converts this sane and reasonable request into "Write holding registers, 0-2, (uint[])25".

If you really do need to have multiple loops talk to one slave:

1-If TCP, just open multiple separate connections. This gets rid of the lock and most slaves will support it

2-If serial, you're more likely to run into issues because of how visa works. You could technically make two masters on the same visa port, but visa won't protect you from accidentally sending two requests simultaneously, which could lead to reading back the responses in the wrong order, which is of course not great. For this, I'd recommend using your own DVR or global variable (have one loop be the 'owner' who has to maintain the connection, but other loops can grab it and attempt to write to it, ignoring any errors or perhaps sending a "hey do your job" to the loop who is supposed to maintain it).

0 Kudos
Message 329 of 529
(4,542 Views)

Hi

I am using this driver and it works without any problems.

I am facing a problem though... I need to send user defined funtion codes but as I understand it the driver "only" support standard ones.

Is there a way to send user defined codes or is there a workaround in available?

Best regards, Glenn Norberg

0 Kudos
Message 330 of 529
(4,542 Views)