View Full Version : Low frequency Hardware PWM
Ioannis
- 15th January 2025, 09:20
Is it possible to have 50Hz PWM with any PIC?
I think Alain mentioned that CCP module could do that but have no clue how.
Ioannis
richard
- 15th January 2025, 09:59
what chip what osc ?
a 16f18426 can do it @8mhz
a 18f27q43 can do it at any fosc
k42 family is a likely candidate too
Ioannis
- 15th January 2025, 13:10
I will not stick to specific PIC.
Any one that can do it is OK with me. K42 is most likely the one.
Thanks Richard,
Ioannis
Demon
- 17th January 2025, 11:09
Is it possible to have 50Hz PWM with any PIC?
I think Alain mentioned that CCP module could do that but have no clue how.
Ioannis
Are you talking PWM or HPWM? Isn't using the CCP module automatically HPWM?
I kept hitting my face into the chart in the PBP manual under HPWM that lists lowest possible frequency per oscillator speed. Even at 4MHz it's a minimum 245Hz (I'm not really interested in PWM).
How are you folks getting around that? Assembler?
richard
- 17th January 2025, 11:26
How are you folks getting around that? Assembler?
its not quite that simple, contemporary chips like 18f27q43 have a pwm module that can use alternative clock sources like the mfosc @[500k] and its that allows 50hz operation, some others have much bigger timer2 type prescalers that can get there in a pinch too
i doubt the hpwm command can select the alternative clock/prescaler so some manual intervention will be needed. its not rocket science and if you plug it into MCC it does all the heavy lifting
Ioannis
- 17th January 2025, 17:38
Are you talking PWM or HPWM? Isn't using the CCP module automatically HPWM?
My interest is in hardware PWM but PBP cannot manipulate the appropriate registers that is needed to get that low on frequency, as Richard noted.
Have not done it yet but hope to manage it.
Ioannis
Aussie Barry
- 23rd January 2025, 22:00
You might consider using the Numerically Controlled Oscillator (NCO) to achieve this low frequency output.
I have recently been looking at the 16F1503 to achieve a stable 1Hz output.
This device has the ability to do both 50% duty cycle (my particular interest) as well as PWM output.
Agreed, this is not something that is doable directly from PBP commands but is quite manageable with register manipulation.
Cheers
Barry
Ioannis
- 23rd January 2025, 23:08
Thanks Barry.
Never thought of that NCO.
Ioannis
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.