I'm trying to enable fast PWM on two outputs on an Arduino Mega with a prescaler of 8 and a maximum count of 2000 (to get 1000 Hz).
My setup code for enabling this is as follows:
void setup()
{
attachInterrupt(0,spinfun,RISING);
pinMode(buttonApin, INPUT);
pinMode(buttonBpin, INPUT);
pinMode(feedPin1, OUTPUT);
pinMode(feedPin2, OUTPUT);
PRTIM3 = 0;
TCCR3A = _BV(COM3A1) | _BV(COM3B1) | _BV(COM3C1) | _BV(WGM31) | _BV(WGM30);
TCCR3B = _BV(WGM33) | _BV(WGM32)| _BV(CS31);
OCR1A = 2000;
OCR1B = 0;
OCR1C = 0;
/*COM3A1 - 1 COM3A0 - 0 COM3B1 - 1 COM3B0 - 0 COM3C1 - 1 COM3C0 - 0 WGM31 - 1 WGM30 - 1
ICNC3 - 0 (unused) ICES3 - 0 (unused) WGM33 - 1 WGM32 - 1 CS32 - 0 CS31 - 1 CS 30 - 0
Fast PWM mode, prescaler of 8*/
}
Is this set up correctly? Which pins correspond to timer 3B and 3C on the Arduino Mega? I've tried googling but I can't figure out which ones are B and C.