I've recently been looking at Timers and I'm trying to generate a PWM frequency at 250000Hz using Timer0 on PIN 4. When I set OCR0A = 63 I get nothing from the light however when I set OCR0A = 125 it turns on ( 128000Hz - according to the formula in the datasheet unless I've been working it out wrong). What's the reason for it not working when OCR0A = 63
#include <DmxSimple.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(250000);
pinMode(2,OUTPUT); // SHIELD DRIVER OUTPUT ENABLE
digitalWrite( 2 , HIGH); // SHEILD DE HIGH
DDRG |= bit(DDG5);
TCCR0A = 0;
TCCR0B = 0;
TCNT0 = 0;
TCCR0A = bit(COM0A1)| bit(COM0B1)| bit(WGM01)| bit(WGM00);
TCCR0B = bit(WGM02) | bit(CS00);
OCR0A = 63 ;
OCR0B = 31;
}
void loop() {
// put your main code here, to run repeatedly:
(1,PORTG |= (1<<5));
(1,PORTG &= ~(1<<5));
}
millisrelated, likedelayor so (because it's updated by Timer0 overflow and it won't happen with that changes)TOP = 0xff