From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what is the simplest way to toggle the counter terminal when time has elapsed in the Complete PWM Example?

Solved!
Go to solution

I have successfully downloaded and executed this: http://www.ni.com/white-paper/2991/en

 

and I know it works because I can see the pulse train on channel #1 on my osciloscope. 

 

I have modified the sample code from the website to use pulse width and frequency knobs that may change dynamically:

 

pwm_mod.JPG

 

 

What I would like to do is toggle the "Dev1/ctr1" to "Dev1/ctr0" every 10 seconds.  I have investigated into the "Elapsed Time" express vi and I am able to successfully count the number of times the time has elapsed, however when 10 seconds have gone by I cannot simply update toggle input to "CO Pulse Freq" with a different counter input because it has already past that object and is busy running in the loop above.  How can I reset the pulse to execute with a different counter input?

 

In short, the Elapsed Time express VI works perfectly by itself, but when the time has elapsed how do I force restarting the pulse train with "Dev1/ctr0"?

0 Kudos
Message 1 of 4
(2,310 Views)

I have attached my VI in case anyone wants to see it.  I'm using labview 11.

0 Kudos
Message 2 of 4
(2,307 Views)

Are you trying to toggle the physical channel?

Carl W.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 4
(2,259 Views)
Solution
Accepted by topic author invasion2121

assuming you want to toggle control from 1 to 0 and back every ten secs and zeroing out the other channel...index the array to write values to one or the other channel.

 

Spoiler
toggle_BD.png

note: if needed...use shift registers to hold onto the last freq/pulse width values for the last channel when toggling to the other. use 'n channel' for multiple counters, concatenate multiple channels on your counter constant

 

Spoiler
toggle2.png

 

0 Kudos
Message 4 of 4
(2,248 Views)