LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I independently change the PWM settings for 2 counter outputs?

A hopefully straight-forward question:
 
- I want to use 2 counter outputs to control the power to 2 heaters using pulse-width modulation.
 
- I have grouped my two counters into a task and am using the DAQmx function "CO pulse time" function to control the "high time" and "low time" for my PWM.
 
- To change the "high time" and "low time" on the fly, I am using a DAQmx property node with the two variables "CO.Pulse.HighTime" and "CO.Pulse.LowTime". The property node is wired up to the task.
 
- Writing to the property node changes the "high time" and "low time" for both channels. How do I control the "high time" and "low time" independtly for each counter?
 
Thanks,
 
Mike E.
0 Kudos
Message 1 of 6
(3,141 Views)

Well, I'll be darned.  Counter output tasks can indeed group multiple channels!  I've been an extensive counter user for many years and just learned that now.  It definitely didn't use to be possible -- I wonder when that changed?  (Note: counter channels still can NOT be grouped for input tasks).

Anyhow, I briefly played with grouped counter outputs yesterday and also didn't find a way to apply changed settings to the channels on an individual basis.  There's a workaround though.

Basically, you just pretend to yourself that the 2 output channels still can't be grouped into a single task.  Instead you go old school and make 2 separate tasks.  Then you can very easily manipulate the PWM for each channel independently.

If anyone else out there knows a way to group the channels into a single task but later manipulate their settings independently, please post and let us know...

-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.
Message 2 of 6
(3,132 Views)
The screen shot below worked for me. I kept the two counter outputs grouped in a task and used property nodes in my while loop to control them  on the fly.
 
Thanks,
 
Mike
Message 3 of 6
(3,132 Views)

Very cool -- thanks for posting!

It looks similar to the way I recall referencing individual plots or cursors from a waveform graph property node...

-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 4 of 6
(3,128 Views)
Great suggestion, Mike. "Active Channels" can be used in general whenever setting / getting properties from a subset of channels in your task. Writing a single counter output value is a great example, but other common uses are enabling / disabling excitation, coupling, range, filter settings, etc. for a single channel.

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 5 of 6
(3,113 Views)
Oh,

And Kevin, I've been meaning to congratulate you on 500 posts! You may not have the thousands that Dennis does, but each of yours are extremely detailed and helpful. All of the AEs here at NI really appreciate your time and effort.

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 6 of 6
(3,110 Views)