waitus and waitms are calculated loops. The code differs based on the crystal frequency and parameter value.
WAITUS is intended for very small delays. It was not designed with the intention to delay for a long time. For those delays, use WAITMS or WAIT.
The problem with WAITUS is that in order to have a big delay, a lot of cycles/loops must be performed when you have a high clock frequency. A word register is used which is not suited for long delays with a high clock frequency.In fact it overflows with the values you use.
I added an error message in case the desired delay can not be created. While i could extend the code to use an extra register i do not think it is worth the effort. _________________ Mark
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum