RE: delay loop
- Posted by kbochert at ix.netcom.com May 18, 2002
- 406 views
-------Phoenix-Boundary-07081998- Some thoughts (guesses) on delay --- procedure soft_delay() for i =3D 1 to 2 + abs(tick/2400) do z=3Dpower(56.982,7.3)/i end for end procedure The execution time of this procedure is highly dependant on caching. Does the entire loop fit in the cache=3F How big is the cache and how many ways does it have=3F This interacts strongly with the multitasking characteristics of the system (other tasks compete for cache space). The best results would probably be had by: Keep the code in soft_delay() as short as possible. The longer it gets, the more likely it is to sometimes execute from cache and sometimes not. Calibrate the length of the loop needed by direct comparison with timer(). Pass the loop length as a parameter to soft_delay(), and count how big a loop is needed to equal 1 second. This insures that the calibration and use of the delay are as similar as possible. Turning off caching while soft_delay() executes may help (just don't ask me how!). Karl Bochert -------Phoenix-Boundary-07081998---