Hello,
For a simple timing loop delay there will be many cycles per loop, depending on the code that the compiler generates. The easiest way to "calibrate" the loop is to simulate operation using the debugger. Simply note the CPU cycles just prior to entering the loop, and immediately after leaving the loop, and subtract the two values.
To test your code, I needed to use the following to prevent timeout of the COP timer -
word cnt2;
for (cnt2 = 35535; cnt2 != 0; cnt2--)
__RESET_WATCHDOG();
To execute the loop with HC08 device required a total of 782193 bus cycles, or about 22 cycles per loop. The total delay will increase should any interrupts occur.
Incidently, using an incrementing loop (rather than decrementing) actually required about 28 cycles per loop.
Regards,
Mac