Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Code -1950679034 when Reading a Shared Variable

Primary Software: LabVIEW Development Systems>>LabVIEW Base Package
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Modules>>DSC Module

Problem:
When trying to read a Shared Variable, I receive warning code -1950679034.  Why does this happen and how can I prevent it?

Solution:
-1950679034 is a warning that the shared variable you are trying to read has no known value.  Warning codes do not halt execution, but they may be an indication of bad data. If you have just created or deployed the variable, it may not have been written to yet.  If you have created an IO server, there could be a communication failure preventing the shared variable from receiving data.

You can prevent this error by enabling the Initial Value option in the shared variable properties page. Upon setting an initial value, you will have to redeploy the library.  In addition, you could simply write a value to the shared variable either in code or through the Distributed System Manager.

Please keep in mind that it is considered good programming practice to give a shared variable time to initialize as well by putting a delay, such as a wait function, before a shared variable read in code. An example of this is shown below. This is only necessary on the first read of a shared variable and if there is no other code before the shared variable read to give it time to initialize.

Good Code



Related Links:
KnowledgeBase 4L6BP728: How to Avoid the "0" Value at First Read of a Shared Variable in LabVIEW 8.5.x?

Attachments:

Good Codegood code.png






Report Date: 01/06/2009
Last Updated: 01/11/2010
Document ID: 4T5DE9U8

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit