LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to create Data Value Reference to Modbus Serial Master

Solved!
Go to solution

I'm adding some Modbus devices to an existing project using the NI Modbus Library. I'm trying to use the In Place Element Structure, but having trouble creating a Data Value Reference for the Modbus instance. Why would I not be able to create a DVR for this particular kind of object? It works ok for the Serial Slave object, but not a Serial Master or TCP Master.

 

eaolson_0-1763503980823.png

I'm working in LabVIEW 2019, because this is an older cRIO processor.

0 Kudos
Message 1 of 7
(298 Views)

Why you want to use DVR? The modbus instance refnum is already an address refnum.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 7
(266 Views)
Solution
Accepted by eaolson

@eaolson wrote:

Why would I not be able to create a DVR for this particular kind of object?

 

eaolson_0-1763503980823.png


If you open the error window and look at the details for that error, you will see the following:

 


This class or an ancestor class has restricted the creation and deletion of data value references to the class. You must call a member VI in order to obtain or delete a reference or change the properties of this class.

If you go and look at the class properties, you will see that there's a checkbox in the Inheritance page which restricts creation of DVRs of the class. You can read the help there to see more details about what this is about.

 

I don't know why this was checked in this specific class, but that's your answer.


___________________
Try to take over the world!
Message 3 of 7
(245 Views)

Hi eaolson,

 

A workaround could be to bundle your object in a cluster:

raphschru_0-1763578479301.png

Note: I have the Modbus library installed with the RT Module, not the VIPM one, but they both have the same issue.

The downside is that you won't be able to wire the DVR directly to a property node, which is the case when the DVR contains the object directly.

 

Regards,

Raphaël.

0 Kudos
Message 4 of 7
(221 Views)
If you go and look at the class properties, you will see that there's a checkbox in the Inheritance page which restricts creation of DVRs of the class. You can read the help there to see more details about what this is about.

You're right, that's exactly why. Not sure why it's like that, but it is.

0 Kudos
Message 5 of 7
(200 Views)

I've often wondered why this checkbox exists, when it is so easily bypassed with the cluster trick.

0 Kudos
Message 6 of 7
(127 Views)

@avogadro5 wrote:

I've often wondered why this checkbox exists, when it is so easily bypassed with the cluster trick.


Looks like NI was aware of it, so I guess it's mainly a matter of placing a hurdle, not preventing this entirely. I agree that this doesn't make much sense if the goal was to allow the developer of the class to force the initialization of the object in the DVR, but I can't say I thought too deeply about it. I personally wasn't aware of the cluster trick and don't think I ever had the need for it.


___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(57 Views)