Timer interrupts from Arduino to ESP8266
Posted: Sat Jun 17, 2017 3:09 pm
I want to adapt a DCF77 radio transmiter in 77.5 khz from Arduino to ESP8266
it use timer registers but I can't find how to translate it from Arduino to ESP
https://github.com/CodingGhost/DCF77-Tr ... ocoll_.ino
Everything compiles ok except these functions ...
void setFrequency(int d)
{
//Frequency = 16000000/d
if(d<0)
d=-d;
if(d<2)
d=2;
TCCR1B&=0xfe; //-Stop generator
TCNT1=0; //-Clear timer
ICR1=d; // |
OCR1A=(d/2); //-+
TCCR1B|=0x01; //-Restart generator
}
void setupFrequencyGen()
{
TCCR1A=0b10000010; //-Set up frequency generator
TCCR1B=0b00011001; //-+
setFrequency(16); //-Start with 1MHz
pinMode(11,OUTPUT); //-Signal generator pin
}
Thanks a lot.
it use timer registers but I can't find how to translate it from Arduino to ESP
https://github.com/CodingGhost/DCF77-Tr ... ocoll_.ino
Everything compiles ok except these functions ...
void setFrequency(int d)
{
//Frequency = 16000000/d
if(d<0)
d=-d;
if(d<2)
d=2;
TCCR1B&=0xfe; //-Stop generator
TCNT1=0; //-Clear timer
ICR1=d; // |
OCR1A=(d/2); //-+
TCCR1B|=0x01; //-Restart generator
}
void setupFrequencyGen()
{
TCCR1A=0b10000010; //-Set up frequency generator
TCCR1B=0b00011001; //-+
setFrequency(16); //-Start with 1MHz
pinMode(11,OUTPUT); //-Signal generator pin
}
Thanks a lot.