05-21-2009 12:28 AM
Hi,
I have the following in my application:
I am using Shared variables published on Host #1, to communicate with cRIO. Some of these commands are paralley given from Host #2.
When it comes to analog values, I am having problems here!
I want Host #1 and Host #2 to be able to change the value of the same shared variable(ex: set the value of a setpoint parameter either from Host #1 or Host #2).
When I tried this, the value I was reading from the shared variable kept toggling between the values set from the Host #1 and Host #2
After this I read a litreature on ni.com suggesting using the RT FIFO and N/w bufferring properties of the Shared variables to avoid this toggling of values.
I have tried almost all possible combinations of these properties, but am getting the same result (toggling).
Has anyone faced the same situation?
How do we get over it?
Any suggestions are welcome
Thanks in advance,
Regards.
05-21-2009 08:29 AM - edited 05-21-2009 08:31 AM
Perhaps you only want to write to the shared variable in the event the value changes. Put the shared variable write in a case structure. Store the host's setpoint value in a shift register. If the setpoint control changes between iterations, then the SV write in the True case will execute.
Now do you want the setpoint control in host #1 to get updated if host #2 does the update? If so, you may want to read the SV immediately afterwards so it can detect the change occuring in the other host.
The attached image should give you ideas, you may need to play with it to tweak it.