Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating Step ladder analog output

Solved!
Go to solution

Hi

i would like to generate a step staircase function that goes from -15 to +15 V using NiDAQ.

But this needs to be triggered externally ie for each trigger pulse I want to generate one voltage -15 and the next pulse generates -14 and so in.

 

currently I am inputting a vector [-15:15] and defining a digital trigger port. So at a single trigger I am able to generate the full ramp and it somehow ignores the rest of the trigger.

While that is okay I really want to generate a step at every trigger.

 

How can I do that?

Trigger rate is 1 kHz

 

I was thinking of using a counter ie each trigger the counter steps up. But how do I go from a digital counter to an analog voltage out?

 

any help is appreciated .

I am using a USB NiDAQ device like 6621

Thanks

 

0 Kudos
Message 1 of 6
(1,167 Views)

Configure the task to use the external pulse as a sample clock signal rather than a trigger.  In DAQmx terminology, a trigger is a one-time occurrence over the life of a task (with exceptions for tasks that are explicitly set to be re-triggerable).  A sample clock is the thing that causes individual samples to be generated or captured, and it happens repeatedly through the lifetime of the task.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 6
(1,142 Views)

Thank you Kevin.

I also found an example 'Cont Gen Volt Wfm-Ext Clk-Dig Start'. So yes as you suggest I should be setting up a clock rather than a trigger.

However, I need a little more help here.

1. My input trigger does not have a 50% duty cycle. Will that matter? Its more like a pulse.

2. In this particular example staircase or step waveform is not available. That is I have to increment voltage for every trigger for a number of triggers and repeat that cycle. I could perhaps think of a way in LabView but I am running NiDAQ from Matlab. So looking for a trigger when it arrives and then issuing a voltage increment does not help because depending on the rate I am missing few triggers

3. I wonder if the way to do this is to use a ramp and adjust its ramp rate to be such that max range to min range occurs over many clock cycles and so it will look like a step staircase waveform?

I will try out few of above suggestions in any case.

0 Kudos
Message 3 of 6
(1,135 Views)

I am a little confused and would like some clarifications.

I am unable to figure why clock needs to be defined when I have already defined and setup a trigger?

Shouldn't external trigger cause next sample to be output? How can I make it re-triggerable for a task rather than make it one instance?

And shouldn't the clock be default internal clock? Is that because if trigger is arbitrarily generated there is no time synchronization between the two? I understand that the output will not exactly occur at the trigger due to this. But is that it?

Can I use the same terminal to be a  trigger and also route it to clock i.e., make that channel external clock?

0 Kudos
Message 4 of 6
(1,102 Views)
Solution
Accepted by topic author gujax23

Answering inline in blue.

 


@gujax23 wrote:

I am a little confused and would like some clarifications.

I am unable to figure why clock needs to be defined when I have already defined and setup a trigger?

Because in DAQmx, a "trigger" is a very specific thing.  As is a "sample clock."   They serve different purposes.  See my msg #2 again.

Shouldn't external trigger cause next sample to be output? How can I make it re-triggerable for a task rather than make it one instance?

No, an external *sample clock* would cause the next sample to be output.  From the sounds of things, you might not need to configure triggering at all, *only* an external sample clock.

And shouldn't the clock be default internal clock? Is that because if trigger is arbitrarily generated there is no time synchronization between the two? I understand that the output will not exactly occur at the trigger due to this. But is that it?

If you follow my advice, these questions will no longer be relevant.

Can I use the same terminal to be a  trigger and also route it to clock i.e., make that channel external clock?

You likely could, but it would serve no functional purpose for you.  Never mind the trigger, just use it as a sample clock signal.


 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 5 of 6
(1,087 Views)

Thanks Kevin

yes I came to the came conclusion but your response was straight and clear. 

0 Kudos
Message 6 of 6
(1,079 Views)