Sunday, March 1, 2020

Accurate GPIO Clock

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

No comments:

Post a Comment