The TPS and what it does.
The Throttle Position Sensor supplies two signals to the ECU: 1) Throttle closed (idle) and 2) Throttle opening angle. Without going into detail these two signals are used by the TCCS to control fuel, idle, and ignition timing.
The TPS has two independent electrical devices inside it but both are mechanically linked. One is the idle contact. It's nothing more than a switch that closes at idle and supplies a ground to the ECU, thus informing it the throttle is closed. The signal is referred to as IDL. It's one of a few signals that'll generate code 51. Code 51 is the only code not retained in memory and it does not illuminate the MIL unless T and E are shorted. As such code 51 can be used as a quick check of the idle contact when in diagnostic mode.
IDL is used for several things but I'm only going to cover a few here. It tells the ECU to enable the idle speed control (ISC) system whenever the throttle is closed. It also enables idle stabilization which causes timing to advance slightly each time the O2 sensor swings lean. Additionally, with T and E shorted, IDL tells the ECU to output Initial Timing to the igniter ie; the timing is derived solely from the physical position of the CPS. If set correctly this will be 10 degrees BTDC.
The other part of the TPS is a potentiometer, a type of variable resistor. It's no different than what's behind the volume knob on a radio. It's function is to measure throttle opening angle. The signal is called VTA for Variable Throttle Angle. The ECU uses VTA to judge how far open the throttle is and how quickly it's moving. When the ECU senses rapid movement of the throttle it injects more fuel by firing all 6 injectors at once for a brief moment. This is called acceleration enrichment. In this sense the TPS takes the place of an accelerator pump in a carburetor.
VTA is also used for cutting injection off when the throttle is closed quickly. This, along with the dashpot, helps prevent an HC spike in emissions when decelerating. Note both of these functions, as well as the TEMS function mentioned below, are rate functions ie; how quickly the TPS moves is more important than it's actual position. When in steady state conditions (cruise or idle) the VTA signal is used as a fuel trim ie; the ECU tweaks the fuel injection duration based on throttle opening angle to a value close to optimum so the O2 sensor system can operate within it's limited range.
The TEMS computer also uses VTA for anti-squat when the throttle is moved rapidly. If you have TEMS you can use VTA for a quick TPS check. Just turn the key on and move the throttle quickly. If TEMS responds the TPS is probably OK. I say probably because this test will not check for the flat spot that most TPSs develop around 25-30% throttle over time. You need to measure the TPS with a meter or scope to fully test for flat spots.
An open or short circuit in VTA will cause few drivibility problems. You could drive around all day long with the TPS unplugged and not notice much difference. You may see a high idle because the ECU won't know when to turn on the ISC system and there may be slight hesitation when accelerating but the engine will otherwise run pretty well. However if VTA is representing WOT the engine will idle rich at appx 4% CO. A short in IDL will result in fuel injection being halted above appx 1600 rpm (7M-GTE) with it being restored at around 1200 rpm.
The TPS can generate two codes: 51 and 41. 51 is caused by the idle contact being open. As mentioned above this is a normal code that should occur in real time whenever the accelerator pedal is slightly depressed. It can be used for a quick check of the IDL contact. Code 41 is set by two conditions: 1) VTA (as measured by the ECU) falls below 100 mv or rises above 4.8 volts or 2) VTA exceeds 1.5 volts when IDL is low (closed).
There's a lot more than this to what the TPS does but for now it's enough...