Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an equivalent vi in DAQmx for "counter control.vi" in old DAQ?

I used "switch cycle" in counter control.vi (advanced counter function palette, LabView 6i) to change counter frequency and duty cycle on the fly without stop the counter with NI PCI6052E.
Is there a same or similar function in DAQmx in LabView 7?
0 Kudos
Message 1 of 7
(3,326 Views)
Depending on the type of channel you are creating (Frequency, Time, or Ticks) you can use the channel property node to set these attributes while the task is running. For Frequency Channels, set the Frequency and Duty Cycle attributes. For Time Channels, set the High Time and Low Time attributes. When generating pulses using Ticks, set the High Ticks and Low Ticks attributes. Since both attributes define the pulse train, the pulse train is only updated once you write to the Frequency, Low Time, or Low Ticks attribute.
Message 2 of 7
(3,326 Views)
Hi reddog:
I'm using Ticks to create pulse train. The application also needs to change pulse width (duty cycle) and initial delay.
I tried to change the channel property node but got errors 200301 and 20057. It seems suggest that the property needs to be set before starting the task but in this application once the counter started, it cannot stop for spec. changing.
Is there anyway to deal with this?
0 Kudos
Message 3 of 7
(3,326 Views)
The Initial Delay can't be changed while the task is running. The Initial Delay is only applicable for the first period of the pulse train, and it would provide no benefit to try and change it at run time. That is why you are receiving the -200557 error. The Low Ticks and High Ticks are settable at run time. However, one full period of the new pulse train specification must be output before trying to update the pulse train again. If you try to update the pulse train before this happens, you will get the -200301 error. To eliminate this problem, I recommend that you either calculate the minimum delay in software to wait before trying to set these properties again or simply ignore the error and try again until it succeeds. If you are still havi
ng trouble programming the counter, you will probably find the information in the NI-DAQmx Help file useful. I recommend looking at the Pulse Generation chapter under the Common Applications chapter.
0 Kudos
Message 4 of 7
(3,326 Views)
Thank you very much.
0 Kudos
Message 5 of 7
(3,326 Views)
I'd like to thank reddog for the great replies and just wanted to make sure that you were able to get all your questions answered Min Shiei. I also wanted to point you to a DAQmx example program for Pulse Width Modulation that allows you to change the frequency and duty cycle on the fly. Refer to the following link to download the example:

http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=BA41A2B9363E1409E034080020E74861&p_node=200509&p_submitted=N&p_rank=&p_answer=&p_source=External

In the code you will see what reddog referred to and the initial delay that is added to the code to avoid the one error that you saw.

Let us know if we can be of any further assistance.

Regards,
Michael H
Applications Engi
neer
National Instruments
0 Kudos
Message 6 of 7
(3,326 Views)
Thank both of you and reddog, the tips are very helpful.
Actually I'm working on an application to generate 2 channels of PWM signals.
Here are the setups:
hardware: PCI 6052E
software: LabView 7
I use both counters 0 and 1 outputs for pulse train generation and DIO0 connects to PFI0, which is used as control of both counters output. PFI0 high is to pause.
Counter is set to use "CO Pluse Ticks". Counter0 has set with delay.
When the application started both counters generated pulses and can change frequency and duty cycle but timing seems to be a problem. I cannot have the counter outputs with same timing every time show on scope.
0 Kudos
Message 7 of 7
(3,326 Views)