Problem often lie in how you interface the LDR to the PIC. But a software crash... well something's wrong somewhere else. Code, hardware... hard to pin point without having the whole thing here...