I'm making a microcontroller programmer and for now, I've been using usleep()
to try to introduce appropriate delays.
It seems that sometimes the program works and sometimes it doesn't.
I tried the -O2
flag when compiling my code but I begin to wonder if that's a mistake.
Also, is there a more accurate timing function I can use besides usleep()
that doesn't involve any libraries not included in the standard system? I don't want to use a function that the system caches in the background (and screws up the timing). Heck, if it means to call a specific address in the system to wait for a clock tick, then I'd rather do that.
Any suggestions?