Hi Anand,

Here is your answer if I understood your question right.

http://www.picbasic.co.uk/forum/showthread.php?t=4907



With some simple modifications, you should be ok.
If you need clarification for the way it works, simply ask here or there.


-------------------------