There is also a bi-metallic switch on the evaporator (behind the glove box), it turns the compressor on and off depending the evaporator temperature (to prevent it from icing up), it may be worth checking it out. Also when you press the accelorator down more than 60% the ECU will turn the compressor off to improve acceleration, it turns it back on 10 seconds after the accelerator comes back under 60% open. So your Throttle Position Sensor may be faulty, you could check for codes on the ECU or disconnect it and see if the problem goes away.