LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variable frequency pulse generation (DAQmx)

Hi,

I am trying to control a liquid injector which requires a 2ms pulse delivered at varying frequency. The problem I have is that with the CO.Pulse generation DAQmx tasks, if I set a long low time (up to 10 seconds) I am not able to interupt this process if I need to quickly increase the frequency. I effectively have to wait for the 10s to elapse before I can change. This won't work in this use case.

So does anybody know how I can create 2ms high pulses, hardware timed (I'm using a 9401 DIO module) where I can dynamically change the frequency and 'interupt' the low time if I need to increase the frequency?

I've attached a snippet of code created in LV2013.

Thanks in advance

0 Kudos
Message 1 of 9
(4,614 Views)

You can stop - change low time - start task at large periods. If you add Advanced DAQmx -> Control task with commit after you configure the task, restart does not take long.

change ctr rate.png

0 Kudos
Message 2 of 9
(4,591 Views)

 

Good advice from Alexander.  I'm not near DAQ hw to test, but there are a couple gotchas to watch out for, I've been in recent threads related to each.

 

1.  I'm not certain whether writing only the Low Time will work.  You *might* also need to re-write the High Time to make the Low Time take effect.  See this thread for more context.  On the other hand, it may well work just fine due to the fact that the task is stopped (but committed) at the time of the write.  Just bear that other thread in mind for future consideration when you want to change pulse specs on the fly.

 

2. When you stop and restart the task, you may find that the specs which stay persistent for subsequent stops and restarts are not what you expect.  Here's a like to that thread.  Fair warning, it's pretty detailed and will require careful reading to absorb and assess the relevance.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 3 of 9
(4,562 Views)

Thanks for your help guys, I might not be able to get round to it today, but I hope to be able to try out these ideas soon. I'll let you know how I get on.

0 Kudos
Message 4 of 9
(4,538 Views)

Hi,

 

Can you please load the actual VI on this forum

0 Kudos
Message 5 of 9
(138 Views)

Hi gvolkwyn,

 


@gvolkwyn wrote:

Can you please load the actual VI on this forum


Whom do you ask when you write "you"?

 

What's wrong with Alexander's 8 year old snippet?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(124 Views)

Hi,

 

I was referring to that snippet. Was looking for the actual VI. Thanks for the response.

0 Kudos
Message 7 of 9
(112 Views)

Hi gvolkwyn,

 


@gvolkwyn wrote:

I was referring to that snippet. Was looking for the actual VI.


Just use the snippet!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(108 Views)

No worries. I figured out what I was struggling with😁

0 Kudos
Message 9 of 9
(105 Views)