Mister_e had an elegant piece of code that worked flawlessly;

http://www.picbasic.co.uk/forum/show...?t=2671&page=1

Hope it works for you.

Regards,

Anand