PWM - multiple pins, one cog
I'm building a CNC machine and would like to be able to adjust the current through the motors using PWM, rather than using a shunt. Ok, I'm rewriting this to make it more clear. Basically, I will be changing what pins are on. This will only be 4 pins that will go to a stepper controller that will step the motor. The pins that are high will change, but I want to be able to use PWM on the ones that are high. I'm not looking for any super high freq. PWM, but my motors will be stepping at 2000steps/sec. From that, I figure I will need to have the PWM about 50-100 times that. Let's say 100-200khz PWM signal? I'm guessing this needs to be done in assembly, which I know very little of. Right now, I just want to know if it's possible to use PWM on multiple pins, while their states will be changing between pulses(possibly). Perhaps in the code, I will only focus on pins 0-3, and consecutively, go through the pins 1 by 1, check if they are on/off, and toggle them accordingly, and reloop.
Suggeestions?
Suggeestions?
Comments