Hello,
I'm trying to emulate Arduino function which is used for functions timing, ... etc.
I tried this function which is working until it hits 43178 and stops every time I run this function, I don't know why.
I think it should counts and prints the values until it overflows, that's what I'm expecting, but it stops at this value every time.
This is my code:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
// enumerations
typedef enum {
START, OVERFLOW
}MILLIS_STATES;
// variables
static uint32_t millis_counter;
void timer_run(void){
if(START == 0){
millis_counter++;
printf("%u\n",millis_counter);
timer_run();
}
else{printf("finished\n");}
}
int main(){
timer_run();
return 0;
}