PWM Question
Faub
Posts: 6
Hi, I am just getting into propeller / microcontroller programming and have a question. I have worked my way through the PE kit tutorials and have a question about using the counter modules to generate a pwm signal.
What I am interested in doing is generating a pwm at 2000 Hz and adjusting the duty cycle. The examples given allowed me to vary the duty cycle but not the frequency. I think it should be fairly easy to utilize the counter to set the frequency and duty, but there must be something I am missing from the PE manual and the Propeller manual counters section. Anything to help point me in the right direction would be most helpful. I did look at the H bridge example but had a difficult time understanding the code in the DAT Block.
All I am really looking for is doing something like LedDutySweep.spin but set the frequency to 2000 hz or adjustable at run time.
Any help would be greatly appreciated.
What I am interested in doing is generating a pwm at 2000 Hz and adjusting the duty cycle. The examples given allowed me to vary the duty cycle but not the frequency. I think it should be fairly easy to utilize the counter to set the frequency and duty, but there must be something I am missing from the PE manual and the Propeller manual counters section. Anything to help point me in the right direction would be most helpful. I did look at the H bridge example but had a difficult time understanding the code in the DAT Block.
All I am really looking for is doing something like LedDutySweep.spin but set the frequency to 2000 hz or adjustable at run time.
Any help would be greatly appreciated.
Comments
www.parallax.com/ProductInfo/Microcontrollers/PropellerGeneralInformation/PropellerMediaPage/tabid/832/Default.aspx
Bare in mind the PWM produced is not quite the kind you would expect, it is more pulse density if I remember rightly.
An excellent way to get PWM is to use Phil's object available in the exchange, it provides up to 8 channels and uses the video hardware, it really is excellent.
Graham