This is going to be a rather specific post that might not really belong here, but I know there are a few on here who have done a bit with microcontrollers, so I thought I'd put it out there, as I've got a scenero that I'm not quite sure where to start with solving.
If I have two banks of LEDS and I want to control the brightness of them via PWM... not a problem if you can have them connected to indepdant transisters on separate pins. If however what you want to control has two groups of LEDS, but all on the same pair of wires, with bank A one polarity and bank B the reverse. Obviously the duty would be maximum 50% for each side (unless time was 'borrowed' from the other side)
Electrically its not too difficult, I could drive each set through a H bridge and have one pin pull the polarity one way and another pull it another way (software glitches could take out the fuses though...) But how to impliment this in PWM, because per cycle in the PWM, you'd have to activate the first output for the correct percentage of the first half, while keeping the second output off. Then at the halfway point make sure the first output goes off, then activate the second for the correct fraction of it.
The only way I can get close to an idea, rather than having the changeover done once per clock cycle, have two PWMs going aty a high frequency, then have a much slower cycle of polairty reversal, using the first PWM to drive the first H bridge input, then stopping, then driving the second with the second PWM input. But my thinking was flicker was likely to be a problem with this, like filming a CRT monitor or similar effect
If I have two banks of LEDS and I want to control the brightness of them via PWM... not a problem if you can have them connected to indepdant transisters on separate pins. If however what you want to control has two groups of LEDS, but all on the same pair of wires, with bank A one polarity and bank B the reverse. Obviously the duty would be maximum 50% for each side (unless time was 'borrowed' from the other side)
Electrically its not too difficult, I could drive each set through a H bridge and have one pin pull the polarity one way and another pull it another way (software glitches could take out the fuses though...) But how to impliment this in PWM, because per cycle in the PWM, you'd have to activate the first output for the correct percentage of the first half, while keeping the second output off. Then at the halfway point make sure the first output goes off, then activate the second for the correct fraction of it.
The only way I can get close to an idea, rather than having the changeover done once per clock cycle, have two PWMs going aty a high frequency, then have a much slower cycle of polairty reversal, using the first PWM to drive the first H bridge input, then stopping, then driving the second with the second PWM input. But my thinking was flicker was likely to be a problem with this, like filming a CRT monitor or similar effect