Can anyone tell me if I can use overflow interrupts on a counter that's being use for phase correct PWM? This might be a dumb question, but since (as I understand it) the counter counts down instead of rolling over to min when it hits max, I thought it was worth asking.
I don't expect this would be chip-specific, but in case it makes a difference I'm using an ATmega8535.
I'm using both of the 8bit counters for two independent PWMs and I'd like to also set a regular heartbeat-style interrupt to take care of basic chores (e.g., compare actual motor speed to target and adjust PWM duty cycle).
To be honest, I'm not sure if I want to use the 16-bit timer instead to establish this "heartbeat" as I haven't thought through the timing to see which would happen at an appropriate frequency. But I was hoping someone could tell me if the 8bit timer was at least an option.
I do anticipate that the same timer running the PWM would be WAY too frequent to adjust the duty cycle based on feedback, so I expect I'd want my interrupt routine to only do real work say 1 out of every 256 times it is called (yes I know that duplicates the 16bit timer). BTW I need to run the 16bit timer with no prescaling (I think) because I'll be using it to calculate RPM and I'd like the resolution.
Sorry for ALL the detail, but I included it in case someone had any other advice.