This should give you an idea -

http://www.picbasic.co.uk/forum/arch...hp/t-2135.html