LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to gen a timed analog output based on discrete input

I am new to LV so forgive me if this is trivial.

I have an analog out board and want to use a digital in to triger a pulse out on the analog line. I am using labview rt on a pxi system. I have it reading the digital in from a pushbutton switch ok, and I can gen voltages on the analog out. What I want to do is everytime i get a button press, add 2 volts to the analog out line for 1ms, then have the analog out go back to zero even if the pushbutton is still pressed. I have done the easy implementation of adding 2 volts to the analog out while the button is pressed no problem. I'm sure there is a simple way to do this, but as I said, I am a newbie, just playing with hardware for the first time.

Thanks.
0 Kudos
Message 1 of 4
(2,811 Views)
Hi BJP-

To verify, it sounds like you have been able to add 2V to the output when the button is pressed. If this is the case then updating the value to subtract 2V back out shouldn't be a problem for you. It seems like the question is how to create the 1ms delay between the two operations.

You should be able to accomplish this easily by using a sequence structure to implement a delay step between the two operations. I have attached a simple DAQmx VI that shows how to accomplish this. "Triggering" is performed by polling the state of a digital line and the sequence executes conditionally based on this state. Basically, each frame in the sequence executes in order so the first and third frames are the voltage updates and the second is simply a software delay.

Please let us know if this is what you or suggesting or if more clarification is needed.

Thanks a lot!

Message Edited by Tom W. on 06-02-2005 04:30 PM

Tom W
National Instruments
0 Kudos
Message 2 of 4
(2,793 Views)
Thanks for the reply!

The vi you sent works if the pushbutton would be pushed and released lightning fast, but since it executes so fast my voltage remains constantly offset as long as the button is pressed. What I need is a way to produce this pulse just one time each time the button is pressed and not allow another pulse again until the button is released and pressed again. I guess the equivalent of a "one-shot". That's where I was hanging up. I know how to implement it in digital logic with flip-flops, but what is the labview equivalent.

Thanks,
Ben
0 Kudos
Message 3 of 4
(2,783 Views)
Hi Ben-

I have modified my earlier VI to include a state machine architecture. Basically, the chain of events on a high signal being sensed is the same, but the VI will stay in a "Wait" state until the line has gone low again.

This could be instantly in the case of a quick press, but if the button is held as you indicated it might then the state will be maintained until a low level is eventually sensed on the line.

Please let us know if this idea doesn't meet the functionality you need to implement.

Thanks and have a great day-
Tom W
National Instruments
0 Kudos
Message 4 of 4
(2,765 Views)