Name: Anonymous 2010-11-17 17:57
Jesus Christ this shit shouldn't be so hard.
IF ANYbody else ever needs fast PWM on PB3, here's the enable stuff:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "setupPWM.h"
void setupPWM() // Sets up Fast non-inverting PWM with no pre-scaler.
{
// Set PB3 as output
DDRB |= 0b0001000;
PORTB |= 0b00001000;
// Set Fast non-inverting PWM without pre-scaler
TCCR2 = 0b01101001;
// Set initial value. 0xFF = 100%, 0xFF = 0%
OCR2 = 0b10000000;
}
IF ANYbody else ever needs fast PWM on PB3, here's the enable stuff:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "setupPWM.h"
void setupPWM() // Sets up Fast non-inverting PWM with no pre-scaler.
{
// Set PB3 as output
DDRB |= 0b0001000;
PORTB |= 0b00001000;
// Set Fast non-inverting PWM without pre-scaler
TCCR2 = 0b01101001;
// Set initial value. 0xFF = 100%, 0xFF = 0%
OCR2 = 0b10000000;
}