(I'm starting a new thread as none of the ones I searched which referenced 'SPWM_INT' seemed appropriate)
I've implemented Darrel's excellent SPWM_INT include file together with ADCIN (reading a trim pot) to adjust the duty cycle for one pin (see my thread here). The problem is that (a) using 8-bit resolution (0-255) makes the LED brightness adjustment a little coarse, and (b) there's a delay in changing the duty cycle no matter how low I adjust the ADC_SAMPLEUS value. I'm willing to live with (b) but I'd like to move to 10-bit resolution to address (a).
Is it just a matter of changingtoCode:DEFINE SPWM_RES 256and then alteringCode:DEFINE SPWM_RES 1024toCode:DEFINE ADC_BITS 8andCode:DEFINE ADC_BITS 10for right-justified values? Will that give me the finer control of LED brightness that I'm after?Code:ADCON1.7 = 1
BTW, I'm using a PIC16F1825 with 16Mhz internal oscillator setting.
Darrel's page (below) doesn't have the frequency range definitions like his earlier Multi-SPWM page, but I think this won't work with DC motors as the frequency needs to be greater than 16,000 Hz. Is that right?
DT_INTS-14 (SPWM_INT - Multiple Software PWM)
http://www.darreltaylor.com/DT_INTS-14/SPWM.html
Bookmarks