Arduino.h and wiring_digital.c problem.

P_LED = portOutputRegister(digitalPinToPort(13));

This line reads the current value of the port output register and stores it in P_LED. This is almost certainly not what you wanted to do.