0

I am trying to generate pulse waves with a width of 2 milliseconds and frequency of approximately 100 Hz as shown below:

Enter image description here

According to this website: http://www.ni.com/white-paper/2991/en#toc1 under the section "Introduction to Pulse Width Modulation" it describes the duty cycle to be 20% if pulse width is 2 ms with a frequency of 100 Hz (or 10 milliseconds).

As you can see in the diagram above the "duty cycle %" indicator correctly computes a percentage close to 20%.

If I perform the calculations correctly, why am I getting a waveform of pulses that have a width of 3 ms instead of 2 ms shown below?

Enter image description here

Following is the back panel diagram containing the logic I am using to generate the waveform:

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user1068636
  • 1,871
  • 7
  • 33
  • 57

1 Answers1

2

Your generation frequency is 1 kHz, so you are at the minimum resolution. Your pulse is 2 ms high. I would advise you to make the samplerate higher.

Ton Plomp
  • 3,020
  • 1
  • 18
  • 35
  • Technically you were correct. I needed to increase my sampling rate. I changed it from 1kHz to 200kHz. This made my square wave actually look like square wave (finally). But the square wave still does not look right. – user1068636 Apr 02 '13 at 02:56
  • I added a new question here: http://stackoverflow.com/questions/15755377/why-are-the-pulse-width-and-frequency-of-pulse-not-correct-in-my-labview-wavefor – user1068636 Apr 02 '13 at 03:05