ESP8266 counting Pulse without Interrupt

Hello,

i try to find a solution for this problem:
i want to count pulse (the frequence, not time of pwm, how many pulse i got). and i dont want to use an interrupt. At this moment i have an interrupt and in this a counter is going up, but the controller have to do other things at the same time.
Does the ESP has a counter? I want to count the pulse direct to a register and read the register.
I dont find a counter in the datasheet. So is there no counter or am i am blind?
And the next question ist... can i build a counter by myself?

thank you.
Best

Post your code as it is now.
How many delay()s do you have in it ?

And the next question ist... can i build a counter by myself?

In the loop(), you simply poll the pin which is connected to the source you are trying to measure.
You increment a counter when there is a transition from, say, HIGH to LOW. You may need to execute a yield() statement in the loop occasionally to prevent the watch dog timer terminating the task.

What approximately is the PWM frequency ?

Given that a normal Arduino PWM signal is around 500 Hz, you would need to check at least every millisecond. I would imagine that some of the ESP's WiFi-related functions that run in "the background" (i.e. between loop iterations and while yield'ing) can easily take more than a millisecond in certain cases, causing you to miss signal transitions.
Why don't you want to use interrupts?

Pieter

hello,
thank you for your response.
okay, i found more about the problem. i think the interrupt is not the problem.
i am connected to an mqtt server. and this connection breaks, when i am starting an PWM Signal (tried different GPIOs as Output).
WiFi Disconnects also. so everything is reconnecting every few seconds. this is not a big deal. but i want to know, why this connection breaks.

if (!mqttClient.loop()) {
   reconnect();
 }

returns an false and the mqtt reconnect:

if(WiFi.status() == WL_DISCONNECTED) {
  //reconnection Code
}

and after i subscribe to topics. Everything works fine! (reconnection and so on)
but after a few seconds when the PWM Signal is on, it needs to reconnect.

this is how i connect to wifi:

//setup Wifi
  Serial.println("Starting Wifi");
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

how i starting the PWM Modul on a GPIO:

  analogWrite(relaisPin, pwmValue); //here i tried different Pins like D1,D5,D7

Setup function:

//GPIO Setup
  pinMode(relaisPin, OUTPUT);

i guess the problem is the PWM? I dont know, what analogWrite() do. and which timer it use? Maybe it uses the same timer as the Wifi connection? any suggestions?
thank you!

I hope you are not trying to PWM a relay? Your code says you are.

Your initial question was how to count PWM pulses. Now you want to output pulses. What is it?

Post all of your code, using [code][/code] tags.

No, i am counting pulse with an interrupt on a GPIO. that works fine and is not the problem... what i thought.
the real problem is, that the WiFi Controller uses the timer which i want to use for the PWM signal.
i found same problems at google.

just looking for a solution in this topic...