Your hardware might have some hardware timers and programmable interrupts. Otherwise, what Jean-Michel said... Time to bring out the FPGAs!
M On Sun, 1 Mar 2020, 05:10 jean-michel.fri...@femto-st.fr, < jean-michel.fri...@femto-st.fr> wrote: > welcome to the field of real time operating systems. There are a few > thousand > pages about the latencies introduced by the scheduler in non-real time OS, > the > first google hit being > https://www.veterobot.org/2012/04/precise-pwms-with-gpio-using-xenomai.html > A few microseconds is not too bad actually. Unless you shift the hard real > time > task to hardware (FPGA), I am not sure you can get any better. > > JM > > -- > JM Friedt, FEMTO-ST Time & Frequency/SENSeOR, 26 rue de l'Epitaphe, > 25000 Besancon, France > > March 1, 2020 12:57 PM, "Till Hülder" <till.huel...@web.de> wrote: > > > Hello, > > > > i want to build a accurate GPIO Clock . I wrote a wait function : > > > > void sleepus(int n) > > { > > clock_t end=clock()+n*CLOCKS_PER_SEC/1000000; > > while(clock() < end) continue; > > } > > > > And wait until the value of the bits change .I recognized that the time > of these wait time is not > > constant. It differs by a few microseconds. > > > > Is there are another way to get a more accurate clock ? > > > > Best regards , > > > > Till > >