LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a ramp using NI-DAQmx

Good evening alltogether,

 

what is a good way to generate a ramp using LV 8.5 and NI-DAQmx? It's supposed to look like a sawtooth, means going up linearly during something like 5 seconds, then drop linearly during something like 10ms.

 

Thanks

Kirill Illenseer

0 Kudos
Message 1 of 9
(5,169 Views)
0 Kudos
Message 2 of 9
(5,167 Views)

The best way would be to make the output a function of time

 

wikipedia

_____________________________
- Cheers, Ed
0 Kudos
Message 3 of 9
(5,166 Views)

Here are links to some examples:

 

Multiple function generator

DAQmx: Simple function generator

 

I hope that helps,

 

Jochen Klier

National Instruments

 

0 Kudos
Message 4 of 9
(5,137 Views)

Thanks, the simple wave generator is perfect. However, I've got another question.

 

As far as I understood, the waveform is generated by the driver on the hardware itself. This is of course good because the the waveform is independant from the CPU load of the PC. But how can I use the generated waveform to trigger something? I have a premade measurement sequence which has to be started when the ramp starts going up. Is there an elegant way to achieve that?

0 Kudos
Message 5 of 9
(5,109 Views)

The output waveform is generated in software and is stored in a buffer in the PC's memory. The DAQ board accesses the buffer via DMA and outputs the signal with very low impact on the CPU.

Depending on the DAQ board type that you use, there are several methods to do what you want. Here are some ideas:

  1.  Use the analog trigger feature of your DAQ device if available:
    You could measure the output waveform with an analog channel and configure this channel to trigger at a certain voltage level (rising edge).
  2. Using a counter for synchronisation:
    If your board doesn't support analog triggering or if you need synchronization with single-sample accuracy, you could program a counter to count the update clock cycles of your analog output operation. As you know exactly the timing of your output waveform, the counter could be programmed to be at low level at the falling and high at the rising ramp. This signal could be either used as a trigger signal for your analog input operation or as a gating signal to control a second counter that generates the AI sample clock (generate no sample clock at falling ramp and generate a sample clock at rising ramp).
  3. Synchronized AI/AO operation
    This is probably the easiest method. Just start a synchronized analog input/output operation and acquire analog values continuously. As you also generate the analog output waveform, you know exactly the length (in terms of samples) for the falling and the rising ramp, so you can easily find the analog input values that correspond to the rising ramps of your signal. You can start with the Multi-Function-Synch AI-AO.vi, that ships as an example with NI-DAQmx and can be found with the LabVIEW example finder.

Regards,

Jochen

Message Edited by Jochen on 11-04-2008 02:22 PM
0 Kudos
Message 6 of 9
(5,101 Views)
The synchronized AI/AO-function sounds good, yet I still have a question. My current measurement sequence contains two AI tasks. The reason is that it has to trigger two shutters (using digital output) with a well-defined duration each. So I use both AI tasks to define the duration of a flat sequnce frame (by dividing the number of samples by the sampling rate). If I'd rewrite the whole program to use one AI task to acquire data, I'll have to use something else to define the duration of the flat sequence frames. My first try were timers which would stop a while-loop, but this was not really useful because this method wasn't accurate. What would you recommend to define the duration of a flat seqenece frame?
0 Kudos
Message 7 of 9
(5,085 Views)

I have several ideas how to accomplish this, but I don't know, which is adequate for your usecase. Could you please describe in more detail how the timing should look like? A timing diagram would be ideal.

 

Thanks,

Jochen

0 Kudos
Message 8 of 9
(5,070 Views)
I've decided to use the easiest method: using my old measurement sequence and using the sawtooth generator in the same VI while having a cable between the AO and AI channel to measure the current output voltage and trigger if it drops below a certain level. The same cable is connected to the input of the of the high voltage ramp control which results in LabView driving the optical instrument. There's the triggering issue left, I've put the into a separate thread.
0 Kudos
Message 9 of 9
(5,019 Views)