Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating "Shared Variable" Map address

Solved!
Go to solution

Hi Experts!

 

I have a question regarding shared variables:

 

At the moment I am creating a Shared variable (81O_G01) in the library and this is binded to :

 

My Computer\SVCREATION.lvlib\Modbus1\410611

 

 

 

Question is: How can I change this SV address (410611) when tha variable has been already opened?  is it possible?

 

Thanks in advance!

 

Anibal

0 Kudos
Message 1 of 3
(5,902 Views)
Solution
Accepted by topic author anibaldos

Hey Anibaldos,

 

It sounds like you are basically attempting to change the binding of a variables from <MB I/O Server>/A1 to <MB I/O Server>/A2 at runtime. I think there are a few options for this:

 

1) In LabVIEW DSC you can access a hosted variable and change the binding address using a property node. If you are running the modbus server on a windows machine, this is the best option. Otherwise, I am guessing you do not have DSC. If that is the case you can still change bindings by editing the library manually, but it sounds like this will not help you out.

2) It may be possible to open a shared variable connection using the palettes (Data Communication >> Shared Variable) to that specific address, in which case you have no need to use the bound shared variable. You can simply open a connection to two different modbus addresses and read from one or the other as needed.

3) If #2 does not work, then I believe you can still use the datasocket API to perform such an operation. There is a little bit of research you'll need to do to use it (for example, URL formatting and UI-thread issues) but it does work. I believe this is the approach taken by this document: https://decibel.ni.com/content/docs/DOC-13508 (from experience I know you have to dig a bit to find the VIs, but they are there).

4) You can use the library on Ni Labs: http://ni.com/labs

0 Kudos
Message 2 of 3
(5,879 Views)

Hello Daniel,

Thanks a lot for the help!

I will review your hints and I will dig a bit deeper as well

 

all the best,

 

Anibal

0 Kudos
Message 3 of 3
(5,869 Views)