07-28-2009 12:53 PM
Hi all,
I'm trying to generate PWM signals with Laminary LM3S8962.
At the begining I thought thant the entry of PWM Output is the pulse width ratio.
I connected PWM2 to AI0 and execute this VI:
By changing the value "PWM Input" AI0 varies strangely
Solved! Go to Solution.
07-28-2009 02:12 PM
Strange results for strange application.
WYSIWYG, but what are you really seeing?
On the chart you see samples from the PWM output waveform - sometimes high level, sometimes low level and between (so, perhaps what you get is better than you actually see). I am hopping you didn't expected to have nice looking waveform allowing measuring the duty cycle of the PWM.
Concluding, your program is modifying the PWM pulse width ratio with a sample period of 20 ms and acquires that waveform with the same sample rate (50 Hz).
If you want relevant results you have to put a low pass filter between PWM output and ADC input.
Also, you can change PWM2 to PWM0 and observe the status LED.
This screenshot could give you an idea about how fast the front panel is updated (!20 ms).
07-29-2009 02:20 AM
Hi Neil84,
Thanks for posting on National Instruments Forum.
Just to add some information about PWM with LabVIEW Embedded for ARM. Did you adjust the divider within properties of the Elemental I/O
from within the project? Here's a little more information taken from
the LabVIEW Help:
"The PWM frequency is the inverse of the
PWM period. A 16-bit divider from the system clock controls the
frequency. For example, if the system clock is 50 MHz, the lowest
possible PWM frequency is approximately 760 Hz. If you need a lower
frequency, predivide the PWM time base from the system clock. To change
the predivider, right-click the Elemental I/O Node in the Project
Explorer window and select Properties. This property affects outputs in
pairs: 0/1, 2/3, 4/5. For example, if you set the frequency for output
4, you also set the frequency for output 5 because both outputs share a
common time base. "
So, with a 50MHz clock and a 16-bit
divider, you would get 50MHz/2^16=762, and so the lowest frequency you
could attain (using the divider value of 64) would be around 12 Hz. You
set this divider value from within the project for the specific PWM
I/O.
Let me know if this clears things up or if you have
additional questions.
Regards,
08-03-2009 11:18 AM
Hi Benjamin,
Today I tried to use PWM as you explained me. by changing the devider I changed the frequency, however changing the input of PWM VI , doesn't change the pulse width on the scope.
08-12-2009 03:02 AM
Hi Neil,
Sorry for the delay but I was on vacation.
By the way, can you tell me which percentage for you PWM you have at the output?
08-12-2009 03:32 AM