I'm doing an environmental control group project for my embedded systems module. I want to generate two PWM signals:
- Control fan speed from ADC readings from a TMP36
- Dim an LED strip depending on ADC readings from Silonex Norp.
We've been using MPLAB X IDE 5.35 and MCC compiler.
The system is set to 20 MHz with HS oscillator and internal (FOSC) clock.
I'd calculated my PR2 value to be 197 and my duty value at 799 and was using CCP2 on RC1 for the LED and ECCP1 on RC2 for the fan. My lecturer just informed me I can't have both generating simultaneously as they're both competing for timer2.
When I've just tried running via Proteus it can't seem to work well above 75% duty sometimes acting as 20%. I've theorized that perhaps it's struggling as 799 doesn't meet the full 1023 count.
Has anyone got any suggestions for generating the two signals so they can be simultaneous, please?