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: 

how to generate digital output of variable duty cycle and clock source being counter?

Solved!
Go to solution

i want to generate a digital pulse every rising edge of my counters pulse. it should have a variable duty cycle. till now i have been able to generate digital output but i cant change its duty cycle.

 

pls tell the ways in which i should proceed??

 thank u in advance..

0 Kudos
Message 1 of 15
(7,509 Views)

If you use DAQmx on counter channel, just use DAQmx write to write a new duty cycle to channel.

0 Kudos
Message 2 of 15
(7,496 Views)

thank u KateB,

yes, i am using daqmx.

but i want to vary the duty cycle of my DO(digital output channel which is synchronised with counter output pulse train)..

 

 

0 Kudos
Message 3 of 15
(7,486 Views)

is this relevant to what you want to do?

http://digital.ni.com/public.nsf/allkb/82C9F3C15F62974E86256EBA0058CAF5

Wan L
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 4 of 15
(7,445 Views)

thanks Wan L,

but changing the duty cycle of counter output is not useful to me as i am using it as a clock(rising edge) to generate digital output.

i want to change the duty cycle of the digital output of my ni6221 module.

thanks any way. i am still working on that..

 

 

 

0 Kudos
Message 5 of 15
(7,416 Views)

Is there a reason why you don't want to use a counter out task?

Wan L
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 6 of 15
(7,404 Views)

thanks WanL,

yes, i do want to use counter for generation of two digital pulse trains. and i m using this counter output for changing frequency of two digital pulse trains.

as there are 2 counters on my pci6221. 

And requirements are:

one counter for counting.

two digital pulse trains having variable duty cycle and frequency.

 

so i hv to use one counter for genration of 2 digital outputs..

0 Kudos
Message 7 of 15
(7,389 Views)

You want to use one counter to generate two pulse trains with different frequency and duty cycle? I don't believe that's possible.

Wan L
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 8 of 15
(7,371 Views)

WanL,

 i have seen some posts on this forum and a few examples which assures that the digital output channels can be used to generate pulses. using one of my counter as clock to both these channels i could generate two pulse trains.

 

example>>cont write digital port- ext clk.vi

 i just want to vary the duty cycle of each digital output pulses.

 

 

 

0 Kudos
Message 9 of 15
(7,347 Views)

That technique requires you to supply your own waveform to the digital write function. In general, you don't HAVE to use a counter as a clock source. If you want to vary the duty cycle, you will need regeneration, and you have supply a new waveform on each interation of the loop. 

Wan L
Applications Engineer
National Instruments
http://www.ni.com/support
Message 10 of 15
(7,334 Views)