astronomerroyal
New Member
Hi,
I'm using an 18F4620 (but may migrate to 18F67K22) and need to implement:
1). LED backlight control using PWM (the leanest, most discreet method).
2). SPI communication at 80kHZ and 500kHz. This is the heart of my application.
The problem is that they both employ TMR2. The PWM module requires TMR2. The SPI module (switching between these two low clock speeds) is ideally suited for use with TMR2 rather than the primary oscillator (fosc/4, fosc/16, or fosc/64).
Separately my PWM and SPI routine work very well, but together it becomes a little socially awkward*. I'd appreciated any wise words regarding the decision-making process at this juncture.
Thanks in advance.
* Specifically, when I switch SPI clock speed (i.e. changing PR2, which I do often) it implies a change in the PWM duty cycle (screen brightness). That's awkward.
I'm using an 18F4620 (but may migrate to 18F67K22) and need to implement:
1). LED backlight control using PWM (the leanest, most discreet method).
2). SPI communication at 80kHZ and 500kHz. This is the heart of my application.
The problem is that they both employ TMR2. The PWM module requires TMR2. The SPI module (switching between these two low clock speeds) is ideally suited for use with TMR2 rather than the primary oscillator (fosc/4, fosc/16, or fosc/64).
Separately my PWM and SPI routine work very well, but together it becomes a little socially awkward*. I'd appreciated any wise words regarding the decision-making process at this juncture.
Thanks in advance.
* Specifically, when I switch SPI clock speed (i.e. changing PR2, which I do often) it implies a change in the PWM duty cycle (screen brightness). That's awkward.