Hello!
Ok, apparently you solved the problem.
However, here are a few remarks about your program:
1. The watchdog timer should be the absolute first action in your program. In your case, you have a loop
filling the LUT first. Well, it might be short enough to work, but in some other cases, your program will keep
rebooting, you will not understand why and your hair will turn gray.
2. You use a lot of __delay_cycles, and that's not the proper way to work because you will just consume
processor cycles for nothing. Imagine that you want to do other actions, you couldn't by using this technique.
Apparently you know how to use timers, so why not using a second one to do the whole thing?
3. In this case, you wouldn't need a while(1) loop.
Dora