LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate time delimited constant output signal on button press

Hi there, Im trying to do something that should be fairly straightforward in an ordinary programming language..

 

On a button press I'd like to generate a constant signal with the amplitude 2 for 2 seconds. Preferably the button should be grayed and disabled during this time period. Once the time period has elapsed the output value should be set to zero. When the button is pressed again (switched back if it is a toggle switch) the amplitude should be set to -1 for 3 seconds and after that timeperiod set to zero. The signal hold times and the amplitudes should be user configurable.

 

The output from this VI will be connected to drive a DAC. The DAC output in turn will be connected to a display and therefore preferably a picture of the corresponding displayimage should be seen on the button that is to be pressed.

 

I've tried different case structures, sequence structures, while loops and signal generators but I am not able to get it to work. If you just know how it should be a fairly simple problem to fix 🙂

 

Rgds,

Stefan

0 Kudos
Message 1 of 18
(4,360 Views)

I've tried different case structures, sequence structures, while loops and signal generators but I am not able to get it to work. If you just know how it should be a fairly simple problem to fix 🙂

Since YOU have tried "different case structures, sequence structures, while loops and signal generators " why dont you post one of then so that we can help?

 

 

Guru

Regards
Guru (CLA)
0 Kudos
Message 2 of 18
(4,360 Views)

Certainly, but I don't think my badly written attempts is a good starting point 🙂

 

Sequence is the first attempt i made with a flat sequence structure. I suspect that i cannot just output a constant when i need a signal and that might be the reason why it doesn't work.

Case signal gen.vi is two different approaches in one were one is using a signal generator and the other is similar to what i tried in the sequence.vi

Defined latch time is an example i found that does output time limited signals but not in a way that is working for me.

 

Rgds,

Stefan

 

 

 

Download All
0 Kudos
Message 3 of 18
(4,347 Views)

This is what came to my mind.....There are other combinations too

 

1.png

Regards
Guru (CLA)
Message 4 of 18
(4,340 Views)

I like the greyed out solution (that I did not know) but my main problem is to generate a time delimited constant amplitude signal. I would think that it has benn done before and the solution should be pretty straightforward but i haven't been able to find anything that satisfies my needs.

 

There should be an easy way to generate a constant signal with the amplitude 2 for 2 seconds. Eventually, as an add-on to the problem, I would like to drive the output with a short pulse (amplitude 2 and 1 s) every second minute. That too should be possible to generate fairly easy? With a timed loop structure maybe?

0 Kudos
Message 5 of 18
(4,333 Views)
Now you are asking to do your code.... bad
Regards
Guru (CLA)
0 Kudos
Message 6 of 18
(4,329 Views)

I'd be happy if somebody just pointed me in the right direction. If I could figure out how to generate the signals I want on my own, I wouldn't be asking would I?

So I guess you don't know the answer? 🙂

0 Kudos
Message 7 of 18
(4,325 Views)

Sequence.jpg

 

Why doesn't something simple as this work? When the switch is toggled (or the button pushed) I set an output to a value 3000 and then I wait 1 second until I set it to 0.

0 Kudos
Message 8 of 18
(4,318 Views)

Her's another implementation that doesn't work as intended. The output doesn't switch to an amplitude of 2 when the state is shifted and back to zero after the delay as i would like it to do.

 

 

Sequence ver2.jpg

0 Kudos
Message 9 of 18
(4,315 Views)

In both of your last examples, you are setting two different outputs, not one and you are using a sequence structure. The outputs do not get updated until the entire sequence finishes. If you are using analog DAQ, then just create a waveform with a proper sample rate and pass it to a DAQmx Write. If you want to use digital I/O, do a write, delay, write.

 

 

Your use of the merge and sequence structure show a lack of understanding of data flow and how LabVIEW works. Have you taken the beginning tutorials?

Message Edited by Dennis Knutson on 03-09-2010 06:04 AM
Message 10 of 18
(4,307 Views)