Timer ISR

Hi,
I tried to copy and run example of how to use hardware timers to trigger an ISR. I used the more or less identical information from

and

my code is:

int timer = 0;  //volatile?
bool state = 0;


void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  //cli();//stop interrupts //notwendig?

  TCCR0A = (1 << WGM01); //Set the CTC mode, clear timer on compare,   prescaler config
  OCR0A = 77; //Value for ORC0A for 1ms

  TIMSK0 |= (1 << OCIE0A); //Set the interrupt request
  sei(); //Enable interrupt warum nicht am ende?

  TCCR0B |= (1 << CS02); //Set the prescale 1/1024 clock
  TCCR0B |= (1 << CS00);
}

void loop() {
  //in this way you can count 1 second because the interrupt request is each 1ms
  if (timer >= 1000) {
    state = !state;
    timer = 0;
  }
  digitalWrite(LED_BUILTIN, state);
}

ISR(TIMER0_COMPA_vect) {   //This is the interrupt request
  timer++;
}

My problem is, that my compiler doesn't know these register names, and ISR(). None of the examples uses an include, for them it works right away. What do I have to include to make it work?

A part of the error messages:

Arduino: 1.8.13 (Windows 8.1), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

timer:55:5: error: expected constructor, destructor, or type conversion before '(' token

ISR(TIMER0_COMPA_vect) { //This is the interrupt request
^

C:\Users\xxxxxxx\Documents\Arduino\timer\timer.ino: In function 'void setup()':

timer:36:3: error: 'TCCR0A' was not declared in this scope
TCCR0A = (1 << WGM01); //Set the CTC mode, clear timer on compare, prescaler config
^
timer:36:18: error: 'WGM01' was not declared in this scope
TCCR0A = (1 << WGM01); //Set the CTC mode, clear timer on compare, prescaler config
^
timer:37:3: error: 'OCR0A' was not declared in this scope
OCR0A = 77; //Value for ORC0A for 1ms
^

timer:39:3: error: 'TIMSK0' was not declared in this scope
TIMSK0 |= (1 << OCIE0A); //Set the interrupt request
^

C:\Users\xxxxxxx\Documents\Arduino\timer\timer.ino: At global scope:
timer:55:4: error: expected constructor, destructor, or type conversion before '(' token
ISR(TIMER0_COMPA_vect) { //This is the interrupt request
^
exit status 1
expected constructor, destructor, or type conversion before '(' token

Clue:

NodeMCU 1.0 (ESP-12E Module),

Google "esp8266 timer"

As you yourself wrote recently

Everything is a lot different on the ESP8266 Nodemcu.

TheMemberFormerlyKnownAsAWOL:
Clue:

What do you mean with this clue? This processor doesnt have such timers?

I found the "ticker" also, and it works smoothly so far and it is easy to set up. But I thougt I should get the other way working too.
Thanks for the hint, I will read this:

The processor undoubtedly has timers
But they're not AVR timers.

And I found out my other hardware the Esp32 is different again.

Yep.

If it helps someone, this is an example code for the ESP8266 timer:

/*
    ESP8266 Timer Example
    Hardware: NodeMCU
    Circuits4you.com
    2018
    LED Blinking using Timer

  Höhere Frequenzen als Ticker
  Timer0 von Wifi belegt, Timer1 frei
*/
#include <ESP8266WiFi.h>

//=======================================================================
void ICACHE_RAM_ATTR onTimerISR() {
  digitalWrite(LED_BUILTIN, !(digitalRead(LED_BUILTIN))); //Toggle LED Pin
 // timer1_write(600000);//12us   //start again if TIM_SINGLE
}
//=======================================================================
//                               Setup
//=======================================================================
void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);

  timer1_attachInterrupt(onTimerISR);
  timer1_enable(TIM_DIV256, TIM_EDGE, TIM_LOOP);  
  /* Dividers:
    TIM_DIV1 = 0,   //80MHz (80 ticks/us - 104857.588 us max)
    TIM_DIV16 = 1,  //5MHz (5 ticks/us - 1677721.4 us max)
    TIM_DIV256 = 3  //312.5Khz (1 tick = 3.2us - 26843542.4 us max)
    Reloads:
    TIM_SINGLE  0 //on interrupt routine you need to write a new value to start the timer again
    TIM_LOOP  1 //on interrupt the counter will start with the same value again
  */
  timer1_write(31249); //100 ms // for fclk=80MHz  (fclck/prescale*t)-1  Register 32bit?
}
//=======================================================================
//                MAIN LOOP
//=======================================================================
void loop()
{
  delay(1000);  //works while delaying
}
//=======================================================================