Yup, that works great and a lot shorter, you're the man !!

Now the question so i can learn how you did it.

How does the PWM command know to output on pins PORTC.0-4. I'm guessing its to do with the 8 - 12 you have placed in the for next loop. But if that were true, why is it not outputing to pins PORTB.0-4.

I base that on the following:

0-7 = PORTA.0 - 7
8-14 = PORTB.0 - 7
15-21 = PORTC.0 - 7

Thanks again.

Steve