Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Ouput Update

Hi Vectrix,

So it sounds like you need to output a repeating sequence of values timed to an external 21 kHz clock. To do this I would recommend taking advantage of analog output regeneration. This will let you write the output sequence to the buffer once and then the card will output the sequence over and over. You can time this to be synced with an external clock. An example of this can be found in the NI Example Finder. In LabVIEW go to Help >> Find Examples… >> Hardware Input and Output >> DAQmx >> Analog Generation >> Voltage >> Cont Gen VoltageWfm – Ext Clk.vi. The external clock will be your 21kHz signal and you can replace the examples waveform with your repeating sequence.

One thing I noticed in your VI is that you have 300 wired to the rate terminal in the timing vi. When you are providing an external clock the rate terminal should be set to the highest frequency you expect that external clock to run at, in your case 21000. Also you will want to set the sample mode to “Continuous Samples”. Please let me know if you have any questions and take care.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 11 of 18
(1,962 Views)
Hi Nathan,

Thanks for the speedy reply. However, the example doesn't quite suit my application. There are two complications. Firstly, I would like to take out the "Desired Frequency" input parameter and have the output to depend solely on the external clock. Secondly, from my understanding of signal regeneration is that the waveform is fixed. (One write to the buffer and the output will continuously generate whatever is in the buffer.) Due to the fluctuation and the packet like behaviour of the external signal, a fixed waveform is not desired. Instead, the output should ONLY increase/decrease by a predefined amount when the device sees the rising edge of the external clock. This is quite different from outputtig a fixed waveform (say 3 steps) on every rising edge.

I hope that clears things up a little. Any suggestions?

Your help is greatly appreciated,
Vectrix
0 Kudos
Message 12 of 18
(1,958 Views)

Hey Vectrix,

The way the example I showed you and hardware timed analog output works is that on each edge of the external clock 1 sample from the buffer is output. It does not output the entire buffer on each edge.  When the end of the buffer is reached it starts over from the beginning. So if you write 0,3,6,9 to the buffer on the first clock edge 0 will be output. On the second edge 3. Next edge 6. Then 9. On the fifth edge 0 will be output again and so on. This sounds like the behavior you were looking for. When using an external sample clock the output will be timed to that clock and only output a sample on the active edge of that clock. You still however need to set the rate terminal of the timing VI with the highest frequency that you expect that external clock to run at. This is so the drivers know how large of a buffer to allocate for the task. This value is used to setup the timing of the acquisition only when using the internal sample clock. If you provide an external sample clock the output timing will depend solely on that clock. I hope this helps and let me know if you have any questions.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 13 of 18
(1,940 Views)
Hi Nathan,

I have finished writing the program with desired funcitonalities. Couldn't have done it faster or better without your help or the forum.

Thank you very much,
Vectrix
0 Kudos
Message 14 of 18
(1,909 Views)
Hi Vectrix,

would you mind posting your code here ?

I'm sort-of stuck with the same problem : I have an output signal that I want to manipulate programmatically, but as with your problem, the changes in the waveform are not reflected when I measure the output-pin. Only after aboutr 3 to 5 iterations of the waveform will the new data be outputted

I noticed that turning OFF regeneration will solve that problem, but then I'm stuck with a SINGLE waveform rather than a continuous output

got any hints for me ?

thanks !

Jeroen
0 Kudos
Message 15 of 18
(1,809 Views)
Hi Jeroen,

I have posted my code below. Hope that helps.

Is your output signal an arbitrary waveform? My outputs are single voltage outputs, so the codes itself is very simple as you will see. I would imagine modifying the codes to output an arbitrary waveform upon receiving an external wouldn't be too difficult (however I don't think it's entirely trivial neither).

How are you controlling the generation? External trigger or internal clock? Could you perhaps explain your setup in more details, and I will try to help out however I can.

Best,
Vectrix


Message Edited by Vectrix on 07-03-2008 05:39 PM
0 Kudos
Message 16 of 18
(1,786 Views)
Hi Vectrix !

thanks for your reply. I've detailed my problem in another thread on the forum :

http://forums.ni.com/ni/board/message?board.id=231&thread.id=5819

I do get the code working, but the changes in the data buffer are only reflected in the output signal after quite a few regenerations


I'd be very grateful if you could help me out there.

my signal is fairly simple : a sine wave or a block wave, but the amplitude should be switchable on-the-fly (triggered by a TTL signal that comes from a special device)
0 Kudos
Message 17 of 18
(1,780 Views)

Hi Jeroen,

I have attached a vi that does exactly what you have described in the other forum. I have not seen any delays in the response while running the code on my system.

The vi is a modified version of the example library.

Hope this helps,

Vectrix

0 Kudos
Message 18 of 18
(1,690 Views)