LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop can't stop - comparator event doesn't fire

Hello,

 

In my setup While loop should be stopped once input signal goes over a threshold.

Fig.1 - Block Diagram, Fig. 2 - Front Panel (running).

As you can see, input signal (red sawtooth) goes over 2.8V (threshold).

So comparator should wire and stop While loop. But it doesn't.

What is wrong in my realisation ?

 

Also a couple of additional questions:

  1. How the labels of signals in WaveForm Graph are formed - I thought that they originated from signal labels, but it seems not be the case.
  2. When stopping While loop with "stop" button, I hope to find the last signal value in Numeric indicator, but instead find the same value - small value,close to 0. Is it normal behavior for shift register ?

 

Thanks in advance

 

Pavel

 

Fig.1

Comparator_Doesnt_Work - BlockDiag.JPG

 

 

Fig.2

Comparator_Doesnt_Work - FrontPanel.JPG

 

 

 

 

 

0 Kudos
Message 1 of 7
(3,355 Views)

Overall, i recommend you to NOT use the DAQ Assistant.

 

However, the question is how you configured the ADC DAQ Assistant:

Is it single point software timed or do you acquire waveforms?

If you acquire waveforms (which i assume), the error you are doing is to convert this to a single double value. That means that you only extract the (i guess) last value of the waveform which is obviously even less than 0.

 

Norbert

 

EDIT: To address your additional questions:

1.) The name of the waveform is as far as i know defined in the DAQ Assistant (your configuration). As i obviously never use the DAQ Assistent besides "Quick and Dirty Testing" i am not sure.

2.) Same answer as to why your loop doesn't stop with the signal going above 2.8 V. And please take a look into your image of the waveform graph: The last value of both signals is very close to 0, obviously a little below (esp. the red signal).

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 7
(3,348 Views)

If you want to learn how to "not use the DAQ Assistant", do a Web search for "Learn 10 Functions in NI-DAQmx" and read the excellent NI White Paper at that site.  In addition to not using the DAQ Assistant, I also recommend that you stop using Signal Wires and use Waveforms (or Arrays of <numerics>) instead.

 

Bob Schor

0 Kudos
Message 3 of 7
(3,337 Views)

Thank you for feedbacks.

 

Probably "DAQ Assistant" isn't adapted for the setup like mine ... I'll follow your suggestions and try with NI-DAQmx.

In the meantime I simplified my setup - removed DAQ Assistant and some other staff.

Now it looks like this (Fig.1) ... unfortunately I couldn't insert picture: feature suddenly disappeared ???

But Ok, I've put VI in attachment.

 

When I started to explore this setup, everything was OK -  comparator fired event and while loop stopped once amplitude of sawtooth surpassed 2.8V and tank value changed in runtime according to amplitude and frequence.

But suddenly everything changed ... no more comparatoor firing, neither tank animation.

 

Whar could happen ?

 

Thanks.

 

Pavel.

 

 

 

 

0 Kudos
Message 4 of 7
(3,300 Views)

I've found error in previous case: in "Simulate Signal" number of samples was grater than samples per second.

0 Kudos
Message 5 of 7
(3,290 Views)

Pavel,

 

please use more descriptive VI names in the future.

The VI you attached includes "Simulate Signal" which creates a huge array of data. You simply check the last value, so the issue is the very same as in your original question.

 

What is the purpose of the whole stuff?

You cannot write some "controller" when working with large arrays as long as time delay is not an issue.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 7
(3,289 Views)

Hello Norbert

 

Yes, you are right - the problem was in timing parameters of "Simulate Signal" block.

I've changed them in the original setup (with 2 DAQ assistant blocks) and now the original setup works.

What I did - I've merely changed the ratio saples per second / number of samples to be 10 (instead of 1 as before)  in the "Simulate Signal" block.

Strange phenomena ... or probably I've missed something.

 

The purpose of all this staff is emulating of my testbend measurement control: there are 3 different analog outputs that generate slow (about 1Hz) sawtooth waveforms that consequently are applied to measurement testbend.

Under consequently I mean when 1st analog output is operating, all other output keep theirs default values.

Once input signal from measurement testbend is evaluated to a particular value, the value of 1st analog output is frozen and 2nd analog starts to generate sawtooth ... also until satisfying some particular condition on the input.

Once condition satisfied, 2nd analog is frozen and then 3rd output starts ...following a similar scenario.

 

Working on this example I'm trying to emulate (in simplified manner) the behavior or the real testbend operation.

 

Thanks

 

Pavel.

 

0 Kudos
Message 7 of 7
(3,270 Views)