2020-03-25, 01:08 PM
Hmm, can you point me in the right direction? Not sure which part of motor.ino I need to adjust for the khz, found this part but not sure:
Code:
if(pwm_style == 1) {
TCNT1 = 0x1fff;
//Configure TIMER1
TCCR1A=_BV(COM1A1)|_BV(WGM11); //NON Inverted PWM
TCCR1B=_BV(WGM13)|_BV(WGM12)|_BV(CS11); //PRESCALER=8 MODE 14(FAST PWM)
ICR1=40000/DIV_CLOCK; //fPWM=50Hz (Period = 20ms Standard).
TIMSK1 = 0;
} else if(pwm_style == 2) {
TCNT1 = 0;
TCCR1A=_BV(COM1A1)|_BV(WGM11); //NON Inverted PWM
TCCR1B=_BV(WGM13)|_BV(WGM12)|_BV(CS10); //PRESCALER=0 MODE 14(FAST PWM)
// use 1khz safe at all speeds. 20khz is nice to avoid
// audible sound, but you need to set minimum speed to 20-30%
// or it will overheat the part at very low speeds.
ICR1=16000/DIV_CLOCK; //fPWM=1khz
TIMSK1 = 0;