Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Counter output cannot update duty cycle...?

I'm encountering (pun not intended) a strange issue with my counter generation. I am currently using this example (https://decibel.ni.com/content/docs/DOC-8306) to generate a PWM signal that can change the PWM frequency on the fly. The VI from the link works beautifully.

 

... However, it's when I build an equivalent VI in Labview 2012 that I start encountering problems. It keeps telling me that it cannot update the duty/frequency because the previous cycle was not completed. I placed various wait and "is done?" blocks before the property node to no avail. Short of putting a stop before the property node, I'm really curious as to why this is not working from Labview 8 to 2012. I've even started up a blank VI, copy/pasted the reference code, and having the same error message pop up. For reference, I've included the 2012 VI. The reference VI can be found at the link above.

 

 

I do know the alternative is to write single pulses for each while loop iteration (similar to http://zone.ni.com/devzone/cda/epd/p/id/5712) but I'd like to understand why my previous attempts did not work.

 

 

Thanks!

 

 

edit: I should also state that I'm using the myDAQ as my hardware platform.

0 Kudos
Message 1 of 4
(6,024 Views)

Were you using the myDAQ on the previously working version?  I experimented with a few different devices and found that I got the error on some devices but not other.  I'm not completely sure why that is the case at this point.  Also, check out this article: http://digital.ni.com/public.nsf/allkb/5F4D0C03B345468986256E85005A2FCC?OpenDocument

James K.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 4
(6,002 Views)

The inconsistent behavior across DAQ hardware in this scenario has always bothered me (I made a chart some time long ago before myDAQ was released but I don't have it handy anymore).  I can't say for sure what will/won't work for myDAQ since I don't have one to test out, but I would probably try the following:

 

 

1.  Use DAQmx Write instead of the property nodes to update the values:

 

COWrite.png

 

 

 

2.  If that doesn't work, try checking the RdyForNewVal property first:

 

CO.ReadyForNewValueWrite.png

 

 

 

3.  If that doesn't work, try going back to the property node instead of the write (but keep the CO.ReadyForNewVal check):

 

CO.ReadyForNewValueProperty.png

 

 

4.  If that still doesn't work, try switching the order that you write to the Freq and DutyCyc properties (though this one is very much a long shot).

 

 

 

Best Regards,

John Passiak
Message 3 of 4
(5,986 Views)

Sorry for the late reply everyone. I actually had it working with the property node method -- I still don't know why it works to this day! -- by using local variables inside the loop. I don't know *why* it works this way though. I also don't use the "Is done?" function either...

 

Eventually, I switched over to the DAQmx Write method simply because it responded faster to any changes within the loop. Before, it would take anywhere from 2-10 cycles before the counter would update if I had other DAQmx reads inside.

0 Kudos
Message 4 of 4
(5,981 Views)