LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-Modbus TCP Slave on LabVIEW RT

Hi,
 
NI provides a freee downloadable Modbus library.  It supports both Modbus-Serial and Modbus-TCP.  Also, has implementations of both Slave and Master:
 
 
I am trying to use the Modbus-TCP Slave on RT (i.e., make my cFP the Modbus Slave).  Has anyone tried this?  I am having problems dynamically launching the Slave demon VI from the library.  I get an "VI not executable" error (#1003).  It uses Timed-loop and that could be an issue. 
 
Any pointers would be much appreciated.
 
-Khalid
Message 1 of 11
(6,934 Views)

Hi Khalid,

I just attempted and ran the Slave demon VI with LabVIEW RT 7.1 and a FP-2010 without generating the VI not executable error.  What compact FieldPoint device are you using and version of LabVIEW Real Time?

Regards,

Steve

0 Kudos
Message 2 of 11
(6,906 Views)

Thanks for looking into this Steve.

I am on LabVIEW 7.1.1 and have tried on cFP 2120 and 2020 -- I don't think this really matters. 

In your test, did you try launching the Ethernet Slave Demon VI dynamically (from a VI not in the NI Modbus.llb)? 

-Khalid

0 Kudos
Message 3 of 11
(6,901 Views)

Kahlid,

I did not try dynamically launching the Slave Demon Vi dynamically yet but will try this and let you know the results.  The key issue, that causes the 1003 error, is that LabVIEW on your host computer is a development system and the LabVIEW in the FieldPoint controller is a run-time version.

The primary behavior difference in this instance is that a run-time engine can not re-link VIs. If the dynamically launched VI has any sub-VIs, it needs to know where to find them. The run-time engine can not search for VIs (including vi.lib VIs) because they are not resident in the FieldPoint controller, and searching/relinking is a Development Environment capability, not a run-time capability.

I found a good forum post that has some good questions and answers that might answer some of your questions.  I have linked this post below. The last several post have some good general tips

http://forums.ni.com/ni/board/message?board.id=170&message.id=118121&requireLogin=False

Hope this helps.

Regards,

Steve

 

Message 4 of 11
(6,887 Views)

Thanks Steve.  Your response was very helpful. 

Just wanted to add that the Timed-loop, in its internal implementation, calls lvalarms.vi (you won't see this as a sub VI on the diagram; but will see it under "This VI's sub VIs" menu item).  And since this VI is not on the RT target we receive the error. 

The solution is what you mentioned. 

-Khalid

0 Kudos
Message 5 of 11
(6,870 Views)

Thanks for the update Kahlid.  You are correct about the lvalarms.vi and the cause of the error. I received the same error on my first attempt at Dynamically calling.  After accounting for this, the error is corrected. 

I'm glad the post helped out and good luck with the rest of your application.

Steve B.

 

Message 6 of 11
(6,854 Views)
Hi,
I am currently working on a project which require to implement the Modbus Slave in the cFP 2120. By your conversation, I understand that we can use the Modbus library inside the FP device. But I am not clear how to lunch the Slave demon VI. Actually I don't know how to use this library in the FP device. Should I add the library as a folder and then use the VIs in this library? Could you tell me more detail about this, or could you send me a small example how to use it?

I highly appreciate your helps,

regards,
Thang Nguyen

Message Edited by THANG NGUYEN on 09-17-2007 03:07 PM

0 Kudos
Message 7 of 11
(5,970 Views)
I tried to add the MB Ethernet Example Slave into the target, and run the MB Ethernet Example Master on the host PC, but it didn't work. Then I tried to build the RT executable file and deploy it into the FP, and it also does not work.
By the way, could you tell me how can I change the address of the register I want to use?

Thanks,
Thang Nguyen
0 Kudos
Message 8 of 11
(5,961 Views)
Hello Thang,

I believe the following links will help you with understanding how to use the library:

http://zone.ni.com/devzone/cda/tut/p/id/4722#1?node=201711#1

Cheers!

-Bob
0 Kudos
Message 9 of 11
(5,826 Views)
hi Bob,
Could I use the MB Ethernet Example Slave.vi to test? I tried it but I receive an error with the reference to the file. I think this is related to what Steve said about the run-time engine. I tried to build the executable file, but it also didn't work. Then I tried to use the MB Ethernet Slave Demon.vi as a subVI then now I have trouble. Now I cannot deploy the program into the target anymore. I just receive the message Waiting for Real-Time target to respond. I don't know how to deal with the Modbus Slave Demon in the target. Could you tell me about this?
Thank you,
Thang Nguyen
Message 10 of 11
(5,676 Views)