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.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

ni 6229 duty cycle

Hi,

 

I'm using NI-6229 board and I got problem with pulse generation by a DO channel, that the duty cycle set value for 'CO Pulse Freq' does not work (or it fails to write the waveform to the digital channel).

 

I ran the VI file 'Gen Dig Pulse Train-Continuous' (given by the example finder) with duty cycle set to 0.1, but it still gives 50% pulse width square wave.

 

Does anyone know how to solve it?

 

Thanks

Jiahua

 

 

0 Kudos
Message 1 of 4
(3,464 Views)

Hi lijh-

 

     Are you looking at the counter output or a separate digital output?  You shouldn't be getting a 50% duty cycle if you are looking at PFI 12 (CTR 0 out).  Is this the channel you are looking at?

 

     Have a great day!

Gary P.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,435 Views)

Hi Jiahua,

 

What you have posted is not the shipping example.

 

Create Digital Waveform.vi is not part of the counter shipping example.  The sub-VI is meant to be used to generate a dummy digital waveform for a Digital Output task.  The graph on your front panel is going to look the same regardless of what you set the duty cycle to, since this graph actually has nothing to do with the configuration of the counter task.  The subVI queries the number of channels in the task (which is 1 in this case) and outputs that many channels of digital waveform data in a ramp pattern (e.g. 0000 0001 0010 0011 0100 ...).  So, with only one channel you'll just see what looks like a 50% duty cycle square wave.

 

The actual output on the counter (PFI 12 for ctr0 by default) should be whatever duty cycle you set when the task is first started.

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 4
(3,429 Views)

Hi, John

 

Thanks for the explanation of Create Digital Waveform.vi!

 

My initial problem is PWM control activated by a DO but not CO channel. I found an example 'Correlated Dig Write With Counter.vi' but the output waveform doesn't respond to the duty cycle set value if I add one to the 'CO pulse output' function. Do you know how to solve it?

 

Thanks,

Jiahua

0 Kudos
Message 4 of 4
(3,416 Views)