I recommend read Darrel Taylor's posts from this point:

http://www.picbasic.co.uk/forum/show...0434#post80434

Download that file and look how he does things.

Robert