Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Command: Current System Clock frequency; the frequency at which each cog is running.

((PUBPRI))
   CLKFREQ

...

Returns: Current System Clock frequency, in Hz.

...

Code Block
waitcnt(clkfreq / 10 + cnt)      'wait for .1 seconds (100 ms) 

This statement divides CLKFREQ by 10 and adds the result to CNT (the current System Counter value) then waits (WAITCNT) until the System Counter reaches the result value. Since CLKFREQ is the number of cycles per second, a divide by 10 yields the number of clock cycles per 0.1 seconds, or 100 ms. So, disregarding the time it takes to process the expression, this statement pauses the cog's program execution for 100 ms. The table below shows more examples of System Clock tick verses versus Time calculations.

System Clock Ticks Vs. Time Calculations

...