PWM Function Question
chiques
Posts: 21
Hello Everyone,
I'm using the PWM and RCTIME functions to generate an adjustable pulse. I was reading the reference manual and noticed the PWM has the following comment.
“
… It outputs a rapid sequence of on/off pulses, as short as 1.6 μs in duration, whose overall proportion
over the course of a full PWM cycle of approximately a millisecond is equal to the duty cycle. This has the advantage of very quickly zeroing in on the desired output voltage, but it does not produce the neat, orderly pulses that you might expect.
“
I quickly figured this out by running the example specified in the book (see figure below).
When I adjusted my Duty variable to about 85, I can see a fairly clean pulse (see 85.jpg).
When I adjusted my Duty variable to about 191, it generated an awful looking pulse (see 191.jpg).
The code I'm using is in attachment rctime_366.bs2
Is there any way to clean this up???
I'm using the PWM and RCTIME functions to generate an adjustable pulse. I was reading the reference manual and noticed the PWM has the following comment.
“
… It outputs a rapid sequence of on/off pulses, as short as 1.6 μs in duration, whose overall proportion
over the course of a full PWM cycle of approximately a millisecond is equal to the duty cycle. This has the advantage of very quickly zeroing in on the desired output voltage, but it does not produce the neat, orderly pulses that you might expect.
“
I quickly figured this out by running the example specified in the book (see figure below).
When I adjusted my Duty variable to about 85, I can see a fairly clean pulse (see 85.jpg).
When I adjusted my Duty variable to about 191, it generated an awful looking pulse (see 191.jpg).
The code I'm using is in attachment rctime_366.bs2
Is there any way to clean this up???
Comments
The Pseudo random PWM signal from the Stamp is showing exactly what it was designed to do. PWM of the Stamp is optimized for converting a digital signal into an analog signal through a simple RC integration. If your looking for a 'fixed' base period of the PWM sutable for driving a motor speed controller you might consider a PWMPAL for the job.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.