Properly doing the job would involve the use of one of the PIC's internal timers. TMRO could be used, load it with a value and let it overflow a few times. Possibly the best person to help you with this would be Darrel. I think he might have some good code that's directly applicable in this area. In fact, the code that you already have
looks remarkably like a working timeout proc
<br/>
Bookmarks