LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview block diagram - help with Event structure

Dear community,

I am having problem running my labview program due to the event structure VI that i have implemented for locking numeric slider to not change values by mistake. but as i also have DAQ in my same block diagram. it is showing an error. How can i rectify this mistake ? I am also attaching a picture of block diagram as well as the error dialogue. 

My logic is that if i change the value of the numeric slider. there should be a dialogue box asking "are you sure you want to change the value?". and only when i click yes it should change or else it should go to the previous value. Kindly help me fix this error. 

I have tried fixing number of samples and increasing the size of number of samples and sampling rate also. What could be the possible error ? 

Thanks
Regards,
Shruthi

shruthiganapathy_1-1739179538141.png

 

shruthiganapathy_0-1739179487966.png

 

0 Kudos
Message 1 of 6
(661 Views)

Don't sample in the same loop.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 6
(652 Views)

Hi shru,

 


@shruthiganapathy wrote:

What could be the possible error ? 


Yamaeda is right.

 

Other items:

  • Don't use a wait in parallel to your DAQmxRead operation. The DAQmxRead should control the iteration rate of your loop!
  • An event should be executed as fast as possible. Calling a Dialog function inside the event is the opposite of "as fast as possible"!
  • Handling "value change" events of knobs can be quite tricky as they tend to initiate a lot of events when you move the knob. In recent LabVIEW versions you could limit the event queue size to circumvent/minimize problems from this…
  • You might think about using the timeout event so the event structure does not block the loop from iterating…

But again: separate DAQ handling from UI handling!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 6
(643 Views)

Thanks a lot for the timely reply. I seperated into 2 while loops and now my numeric slider is working perfectly. 
But i also have one more doubt. what is the best way to collect these data from NI DAQ USB 6009 to excel. i tried using "Set dynamic data" and "write to measurement file" VI's but the same error from my previous screenshot seems to appear. How can i fix that ? 

Thanks and regards,
Shruthi

0 Kudos
Message 4 of 6
(615 Views)

@shruthiganapathy wrote:

But i also have one more doubt. what is the best way to collect these data from NI DAQ USB 6009 to excel. i tried using "Set dynamic data" and "write to measurement file" VI's but the same error from my previous screenshot seems to appear. How can i fix that ?


I much prefer to use the DAQmx Configure Logging to have DAQmx save the data straight to a TDMS file. This is extremely efficient. Assuming you have the TDMS Excel plugin installed, Excell can just open up the TDMS file.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 6
(604 Views)

@shruthiganapathy wrote:

My logic is that if i change the value of the numeric slider. there should be a dialogue box asking "are you sure you want to change the value?". and only when i click yes it should change or else it should go to the previous value. Kindly help me fix this error. 

 


  • The "error" is in your program logic.  Value change events should never contain any user interactive code.
  • That song and dance with the control reference and value property node is completely pointless and would only make limited sense if the event has value change event for multiple controls of the same datatype (But even then, done right there are better ways). A local variable would be perfectly sufficient.
  • Yes, any value change control for sliders should be have an event queue of 1 and not lock the panel.

 

0 Kudos
Message 6 of 6
(576 Views)