LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronised analog generation, analog reading and TTL pulses.

Dear all

 

I have a PCI 6251 card with LabView 7.1.1; I need to generate an analog signal with frequencies of interest between 50 to 200Hz. Lets say for the first experiment I want to generate a 100Hz sine wave, so in the graph of amplitude verses time for this sine wave the time axis is crossed 200 times in a second, after generating the sine wave I need a 4 seconds delay before anything is done, after that the delay doesn’t need to be repeated since the system under test is stabilised for the frequency of interest. I need a TTL output every time the time axis is crossed (lets call this A). I also need a another TTL output, synchronised to the first, but this time only 1 TTL should be written to the port (lets call this B), the position of this TTL is not important in the space of one second that we are talking about. I also need to take analog input measurements, which again should be synchronised to the TTL that we called B. I want the analog measurement to start before the TTL(B), and when the analog measurement in half way through it should be the time that the TTL(B) is generated and then the analog measurement will continue after TTL(B). The amount of analog samples taken before TTL(B) is equal to the amount taken afterwards (I think its called pre-sampling). To round it off I need all these things to happen very accurately in the time domain, so I prefer if the TTL’s are off by microseconds rather than milliseconds, but I am prepared to go on with the milliseconds if there is no other way. Then for second experiment I need to go through the same procedure but this time the analog generation has a frequency of say 200Hz, so TTL(A) should have 400 TTL pulses in a second but TTL(B) should remain at 1 TTL pulse in 1 second.

Could you please help me with this?

 

Regards

0 Kudos
Message 1 of 12
(4,032 Views)
Hi,

Fom what I gather from your post you want a sine wave to be generated for 5 seconds and on the fith second send a digital pulse every time the signal crosses zero (twice the output frequency). How wide would these pulses be or is it just the edges that are important? You also want some time during that second another digital pulse (again how wide?) that will trigger an analog aquisition with pretrigger scans. How many samples will you aquire and at what rate? I have a 6251 card in my machine so will see if i can get something like this going.

Regards

Jon Bowers
Applications Engineer
NIUK
0 Kudos
Message 2 of 12
(3,998 Views)

Hello

 

The width of the TTL are not important since the rising edges are used, however it would be beneficial to have a control over the width, but for now its not that important. Same is applicable to the second TTL. The second TTL which happens once a second (when the sine crosses zero) does not trigger the analog measurement. But like the first TTL it triggers an external device, however I also want to acquire analog data with sampling frequency of 2048 and 512 points using the second TTL with pretriggering. So I think in a way the second TTL is used for pretriggering.

 

Thanks for your help

0 Kudos
Message 3 of 12
(3,996 Views)

Hi again,

I have been trying to set up a system like this. I think it may be possible but it will be fairly involved. How tight do you need the syncronisation between the sine wave crossing the zero point and the TTL pulses? Does it need to be micro second, nano second etc?

Jon B

Applications Engineer

NIUK

0 Kudos
Message 4 of 12
(3,977 Views)

Hello

 

The delay should be maximum of 1 micro seconds.

I have been trying to do program as well, and it is complicated, if it will make it any easier we can ignore TTL (A), but we still need analog output (with a given amplitude and frequency), one TTL output per second when the sine wave crosses the zero in that second (that is TTL (B)), analog input for 2 or more channels with pre triggering on the basis of the TTL (B). Also we still need the TTL (B) to start 5 second after the analog output started so that the system is stabilised.

The analog output drives a speaker, I have tried to use analog output point by point generation, and then at the same time compare the elements of the waveform to zero and if a value was equal to zero, then feed a true statement to a digital output vi, the problem was that the analog output point by point did not work on the speaker and the TTL jumped around (they were all in a loop so I think that was the problem). So it was no where close to the delay that I wanted.

 

Regards

 

0 Kudos
Message 5 of 12
(3,971 Views)
Hi again,

I have made a vi that will output a pulse every time the output waveform crosses zero. There is no aquisition as of yet but I think it is a good solution for the TTL B signal. This is achieved by doing correlated Digital output which uses the sample clock from the AO to make each digital point update at the same time as the Analog.

Regards

Jon Bowers
Applications Engineer
0 Kudos
Message 6 of 12
(3,956 Views)

Hello

 

Thanks for the solution, but there is a small problem. Just tried the new vi, I can see the sine wave on the oscilloscope but the TTL is not there, any ideas?

I did change all the Dev7 into Dev1 and set the digital output to Dev1\port0\line2

 

Regards

0 Kudos
Message 7 of 12
(3,953 Views)

Hi again

 

I have modified the program that you sent me, this one gives me the TTL’s on the oscilloscope as well, the problem is that it gives too many of them in one second and also since it compares the element of the matrix to an upper limit and lower limit values, it is only restricted to certain frequencies.

 

Regards

0 Kudos
Message 8 of 12
(3,950 Views)
Hi again,

Attached is a screen shot from the scope I was using, as you can see from it the digital pulses are very narrow so you will need to set your timebase accordingly. You should only need to change the device as you said and connect up to the correct analog output channel and digital channel. The digital data that I created in the for loop at the bottom of the code contains the edges at the beginning and middle of a single waveform this is repeated for the number of waveforms in one second. This way you don't have to compare any values because you know the frequency and the phase of the sinewave you can work out at exactly which sample it crosses zero

Regards

Jon
0 Kudos
Message 9 of 12
(3,937 Views)

Hi again

 

Thanks for the program, there are still some problems, the TTL’s are used to trigger an external PIV camera system, but it seems they are too fast for it, I know I said the rising edges are important (and that’s what I was told). Are there any industry standard for TTL properties (i.e. slope of the rising edge and so on?)

 

Regards

0 Kudos
Message 10 of 12
(3,933 Views)