Or maybe somethings wrong with the MPLAB setting? When i plug in PICkits to program the chip ( only sensor code), the sensor is working(power from PICkit). Now i program it, plug out PICkit, connect the chip to another power supply, the sensor doesnt work .