Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample and Hold Application.

I am acquiring data with the NI ELVIS on an analog input channel A0.

I need to sample and hold the data according to a 480 Hz (2.08 ms) clock as follows:

1. Acquire data for the 0.69 ms (1st third of the cycle) and place the data into a new waveform.
2. Acquire data from 0.69 ms to 1.39 ms (the 2nd third of the cycle) and place the data into a new waveform.
3. Acquire data from 1.39 ms to 2.08 ms (last third of the cycle) and place the data into a new waveform.

Currently, I have built a VI (attached) to generate two clock signals. The first clock signal turns on a red LED for 0.69ms then turns off for the rest of the cycle. The second clock signal turns on when the first clock signal transititions to a low state for the next 0.69 ms and remains off for the rest of the cycle. Both LED illumination signals are picked up by a photodetector, so this is why I need the sample and hold application explained above.

If you could help that would be great. My current VI is attached. Thanks so much!

-David
0 Kudos
Message 1 of 8
(12,095 Views)
Correct me if I'm wrong, you are turning on two LEDs in a pattern and reading the light level. You want to have three separate waveforms for the light reading, based on when the lights are turned on and off.

If this is the case, here is what I would try:

Trigger your analog input reading off of the turning on of the first LED. You might have to put an initial delay into your clock pulse (that turns on the first LED). This initial delay will insure that the LED is not turned on before the analog input has been started. Data collection will start when the first LED is turned on (the trigger) and will end after the appropriate amount of time. (You could end it in many ways; user presses a stop button, configure collection for a finite number of data points, final pulse has ended,..). After data collection is finished take the single waveform that is storing all of the light data and use the waveform functions in the Waveform palette to split it into your three waveform subsets.

I suppose another way to produce the three waveforms would be to wire your light sensor into three analog inputs, then configure three separate voltage inputs with appropriate triggers based on the turning on and off of the LEDs. CH 1 triggers when LED 1 is turned on, CH 2 triggers when the LED 1 is turned off, CH 3 is triggered when LED 2 is turned on.

I hope this is helpful in some way,

Sam
0 Kudos
Message 2 of 8
(12,077 Views)
Sam,

Is it possible to do this continuously and display the waveforms
in Labview? If so, do you know where I could find some
examples of doing so? Sorry for all the questions I'm kind of new to
Labview.

Thanks,
David
0 Kudos
Message 3 of 8
(12,073 Views)
Hello David,
The LabVIEW example finder includes bunches of great LabVIEW Data Acquisition examples. They install when NI-DAQ is installed (which you must have done, if you are operating your NI-ELVIS unit). You can get to it in LabVIEW by going to Help>>Find Examples. You can then navigate to the data acquisition examples by going to Hardware Input and Output>>DAQmx.
-Alan A.
0 Kudos
Message 4 of 8
(12,065 Views)
Alan,

I've looked at a few of these examples, but I'm struggling a little bit. I have the desired waveform I want and it looks like the following:
____ ____
| | | |
___| | ___| | . . . .
| | | |
___ _| |______| |___

|(1.)|(2.)|(3.)| . . . . . . . .. . . . . .

As you can see there is three different level changes and it repeats
consistantly. What I want to
do is extract the first part, (1.), and stop once (2.) begins.
When data is not being captured I would like the value to be 0V until the next
starting sequence (1.). I need to do this for all three levels. So, if I did this
for part (2.) of the waveform, my new result would be:
___ ___
| | | | ................
______| |___________| |___


I have my initial vi attached in the first message. How can I accomplish this with only one analog input, yet I need to generate three different waveforms? If you could help it would be greatly appreciated!

Thanks,

David

Message Edited by mares_wyo on 06-29-2005 08:22 PM

0 Kudos
Message 5 of 8
(12,065 Views)
Sorry Alan, had a little problem with the white space. Attached is a picture of what that's suppose to look like.
0 Kudos
Message 6 of 8
(12,058 Views)
Here is an example of splitting 1 waveform into 3, based on recurring rising edges. See if this is helpful to get you started.
0 Kudos
Message 7 of 8
(12,029 Views)
If I understand correctly, you want to split your data into pieces based on time. If you know your sample rate (which you will set), then you can read all of your samples, then split up your array of data points. I've attached an example that I put together that does this. I split up the arrays based on 10,000 samples/sec and the times you described in your first post. Hope this helps:)
-Alan A.
0 Kudos
Message 8 of 8
(11,998 Views)