LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to output a TTL signal from a sine wave [Please Help]?

Hi evryone!

 

I am a bit lost...

We make the acquisition of voltage (sine wave, 3Hz) which I simulated by a waveform generation in my VI. We want to convert this analog signal to a TTL and output it with a multifunction DAQ (6230).

 

I only used Analog to Digital.vi and DAQmx write.vi and I can't get it to work... I get a TTL which is not 3Hz and only If I input a frequency like 3.07 and not 3.00 !!

 

Did I forget something ?

 

Thanks for helping

Christophe

0 Kudos
Message 1 of 8
(4,390 Views)

[Edit Post]

 

Just to make sure I am sending the right values, I read the TTL with daqmx-read just after I write it (see VI). And I do not have the same things...

 

Christophe

0 Kudos
Message 2 of 8
(4,381 Views)

Back with new infos!

 

I found a very interesting thread (see below) talking about the frequency problem I have.

http://forums.ni.com/t5/Digital-I-O/How-can-I-write-a-Digital-Waveform-to-the-Digital-Output/td-p/10... 

 

The solution given in this thread is to use DAQmx rather than DAQ given multi threadding properties but I am already using DAQmx.

 

Christophe

 

 

PS : I must use a software solution even though I use M-series because the generation of the TTL is made after the acquisition of the analog voltage.

0 Kudos
Message 3 of 8
(4,360 Views)

In your vi, you don't have DAQmx Timing setup.  I don't know what the default value is.  But the timing determines how fast the DAQ will output values.  If not set correctly, you may see slight change in the output frequency.  Another thing is that the timing is based on a master clock, like 50MHz.  The clock gets divided down until it gets near the desired setting.  So it may not be able to achieve 3KHz exactly.  If you are getting 3.07KHz, this may be why.  I don't know if there is anything you can do about it.  Try using the timing vi and setting different sample rates.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 8
(4,350 Views)

Unfortunately, the digital I/O on the 6230 is only software-timed.

 

Are you trying to output a TTL signal at the same frequency as your input sine wave?  If so, you could use a counter output and adjust the frequency on-the-fly.  You can use an FFT to convert your voltage measurement to frequency, then use the peak value for the input of the counter output task.

 

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 8
(4,344 Views)

Thanks all for your answers!

 

I tried to use Daqmx Timing but every clock always gives the same error -200077 that I will investigate on the forum.

 

And yes, I am trying to output a TTL signal at the same frequency of the input sine. I will look into counters.

 

Christophe

 

0 Kudos
Message 6 of 8
(4,330 Views)

I found that I can't use any sample clock with 6230...

 

I tried to had a counter with the rate set by the analog signal but I still need a sample clock. I used the Correlated Dig write with counter which doesn't work either with my hardware.

 

I really need your help

Christophe

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

Hi Christophe,

 

Error -200077 is just telling you that setting the sample clock on your DO task is not supported (it is only software timed like I mentioned in my last post).

 

The counter method uses Implicit timing which is supported on the 6230.  Please refer to the example that I linked in my previous post for help on getting started with the counter method.

 

 

Best Regards,

John Passiak
0 Kudos
Message 8 of 8
(4,300 Views)