This widget could not be displayed.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate more PWMs than available counters using DIO instead of counter outputs

Hi,

 

*For the purposes of this question, I will list the following hardware that I'm using. That being said, this is a general question that I hope is applicable to any other hardware out there.

CDaq NI 9174 Chassis with CDaq 9401 DIO Module.

 

I need to generate multiple PWM signals (more than 10?) than I have counters (the 9174 has 4 counters). All the PWM signals will have a fixed frequency of at least 100kHz, but need to be able to vary their duty cycle fairly rapidly for use in a control loop (PWM signals are being used to control a MOSFET). I have gotten my system to work using a counter output and varying the duty cycle. I know I could scale that to use all 4 counter outputs to generate 4 independently controllable PWM signals, but I definitely need more PWMs that that.

 

However, I came across an example that uses a single counter to output 4 PWM signals with different duty cycles through the DIO pins (attached). Is there any reason why I should ever use counter outputs instead of digital outputs? It seems I could just use a single counter to generate as many PWM signals as I have DIOs. Or does using a single counter limit the rate at which I can change/control the duty cycle of each PWM?

 

Please forgive my ignorance; I'm still a bit confused about counters and PWMs.

 

(I forgot whose it is and haven't been able to find it again...)

0 Kudos
Message 1 of 3
(2,757 Views)

Also, I keep getting this error when I try to do a Digital out and a counter out on the 9401.

 

 

I've tried putting a control task block (reserve) in front of each start task block but no difference....

0 Kudos
Message 2 of 3
(2,721 Views)

Hi,

 

I think that the principal advantage is that a counter output is much more accurate (hardware timed) than a digital output that generally are software timed. With counters there is always a clock signal (generally an oscillator) that will ensure you that the duty cycle and frequency of the signal will be very precise.

Also I think this KB- 59QILUD2 will help you with the error.

 

http://digital.ni.com/public.nsf/allkb/0495B7D5E2345DF386257730007EFD17

 

Regards,

 

Richard.

0 Kudos
Message 3 of 3
(2,698 Views)