01-14-2010 10:20 AM
Hello
I am developing an C# application (.net framework 3.5) that uses network variable to communicate with a cRIO 9476 card. I've set up a network variable
DO00 in Labview 2009 with the following properties
Variable
variable type: Network Published
data type: Boolean
Aliasing is enabled
Bound to a project variable 'Test-cRIO\Mod1\DO0'
Access Type is read/write
Alarming
Not enabled
Description
Not enabled
Initial Value
Not enabled
Logging
Not enabled
Network
No buffer
is Single writer
RT FIFO
not enabled
Scaling
not enabled
Security
not enabled
My C# code is
public DigitalOutputPort(string portAddress)
{
_portAddress = portAddress;
_networkVariableSubscriber = new NetworkVariableSubscriber<bool>(_portAddress);
_networkVariableSubscriber.DataUpdated += new EventHandler<DataUpdatedEventArgs<bool>>(_networkVariableSubscriber_DataUpdated);
_networkVariableSubscriber.ConnectionBehavior = SubscriberConnectionBehavior.UpdateOnConnect;
_networkVariableSubscriber.Connect();
_portName = GetPortName(portAddress);
}
the event handler looks like
void _networkVariableSubscriber_DataUpdated(object sender, DataUpdatedEventArgs<bool> e)
{
_value = e.Data.GetValue();
DOValueChangedEventArgs e1 = new DOValueChangedEventArgs(_value);
OnDOValueChanged(e1);
}
All of this works like a charm when the NI Variable Manager or the NI Distributed System Manger is running. When
I stop those, the application fails in the event handler on the '_value = e.Data.GetValue()' statement with an error
that states "The NetworkVariableData does not have a value"
I've tried changing the location of the shared variable from the windows 7 system to the cRio and back, but it doesn't seem
to change anything. I've also checked to ensure that the National Instruments Variable Engine service is running (it is).
I'm obviously missing something!
Ideas and suggestions on what I've missed are greatly appreciated
Thanks
Solved! Go to Solution.
01-15-2010 04:53 PM
01-20-2010 09:26 AM
Sorry for the delay in getting back.. It's been a bit snowy up here!
When i say it is running, DSM is open. It doesn't seem to matter whether it is the currently executing application or not, just whether it is open and shows up in the task manager.
Thanks
Steve B
01-21-2010 03:33 PM
01-21-2010 04:24 PM
That was the problem. The variable engine service had been set to manual!
Thank You
Steve B