LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

labview arm pwm

Solved!
Go to solution

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:

Sans titre.jpg

By changing the value "PWM Input" AI0 varies strangely

0 Kudos
Message 1 of 6
(9,639 Views)

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).

 

Configure Target.JPG

0 Kudos
Message 2 of 6
(9,630 Views)
Solution
Accepted by topic author neil84

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,

    Benjamin R.


Senior LabVIEW Developer @Neosoft


Message 3 of 6
(9,619 Views)

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.

0 Kudos
Message 4 of 6
(9,572 Views)

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? 

    Benjamin R.


Senior LabVIEW Developer @Neosoft


0 Kudos
Message 5 of 6
(9,484 Views)
About 40%
0 Kudos
Message 6 of 6
(9,482 Views)