Actually, it loops 501 times. it loops with i = RN_DelayLoop for the first loop, then i = RN_DelayLoop+1 for the second loop, i = RN_DelayLoop+2 for the third, etc... all the way to i = RN_DelayLoop+500 for the 501st loop.
Although I cannot see that as being the cause of the slowdown, unless you're accidentally writing to an extra byte that's out of range which I would think would be caught by the debugger.
If you want it to iterate exactly 500 times, the command should read For i = RN_DelayLoop to RN_DelayLoop + 499.
Although I cannot see that as being the cause of the slowdown, unless you're accidentally writing to an extra byte that's out of range which I would think would be caught by the debugger.
If you want it to iterate exactly 500 times, the command should read For i = RN_DelayLoop to RN_DelayLoop + 499.