Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

how to modify pulse settings on the fly with c#/measurement studio.net

Using Measurement Studio 6.0 I can easily modify pulse settings for the 6602 on the fly.  I have not been able to figure out how to do this using Measurement Studio.net/c#.  It seems to force me to stop the "task" then start a new task with the modified settings, interupting the pulse train.

Very annoying that the new, improved version seems to eliminate functionality.
0 Kudos
Message 1 of 6
(4,364 Views)

Hi,

I believe you may be running into a couple different issues here. You were using Traditional NI-DAQ with Measurement Studio 6, with .Net you're probably using NI-DAQmx. There is a bit of a learning curve when transitioning, but hopefully we can help you out. We certainly didn't eliminate functionality, it is just organized differently and for me the transition to .Net itself makes thing fun. You can change the duty cycle on the fly with:

myCOChannel.PulseDutyCycle = <new duty cycle>

 the and the frequency with:

myCOChannel.PulseFrequency = <new frequency>

I believe there are other ways, but I'm more of a DAQ programmer than .Net. You can use these calls after you start the task. Hope this helps - please post if you have any additional questions.

Andrew S 

 

0 Kudos
Message 2 of 6
(4,352 Views)
Andrew,

thanks for your post.  I am able to change these settings but they are not applied unless I stop, then start the daqmx task.  This, of course, interrupts the pulse train, which I am trying to avoid as it makes bad things happen on the terminal end of things ("Try to imagine all life as you know it stopping instantaneously and every molecule in your body exploding at the speed of light.").

This used to be done with the "Reconfigure" function (changing the pulse width, not the molecule exploding thing).

Derek
0 Kudos
Message 3 of 6
(4,346 Views)

Hey Derek,

I'm not sure how you are trying  to implement this, but I've attached a modified example that works for me - again probably not great .Net programming but it works. I did notice that in order to change the duty cycle you need to set the frequency right after it, this may be what you were running into.

Cheers,

Andrew

0 Kudos
Message 4 of 6
(4,334 Views)

Derek,

The thing Andrew observed is that for some reason, writing a new duty cycle value doesn't cause it to be commited to the counter hardware until/unless a frequency value is also written.  This is true even if the new freq value is the same as the previous.   See this kb article.

-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
(4,326 Views)
That is very likely why I wasn't seeing my changes updated.  I will test this out, thanks very much for the input to both of you.
0 Kudos
Message 6 of 6
(4,323 Views)