It appears that If an object is really close to the SRF05 sensor the code will get stuck. I'm thinking this is because an interrupt occurs while i'm waiting for a pulse from the SRF05. since the object is close the pulse is short and ends before the program returns from the interrupt. I've tried to disable interrupts for just that short period of time but that isnt working.
my code looks like this (if you'd like to see more just ask)
bcf INTCON,GIE ;temporarily disable interrupts