To detect if the 40MHz is there with a normal pic is not possible.
What you can do is next:
Build a detector for the LF signal the transmitter is sending.
A coil and a capactor in parrallel tuned on the right frequency a diode a resistor and a capacitor will do.
This detected LF signal is than after amplified or via a comperator fed to the pic.
Then you can compare in the programm of the pic if the right code was sent.