Sorry it took so long to answer this... been a while since I've visited this particular forum.
P0765 is a UD Solenoid Circuit fault, which indicates a problem with (duh) the UD solenoid circuit. This fault will put you in full limp-in mode (4th gear all the time with no TCC engagement), so truck will feel really sluggish when you launch from a stop, and will have high RPMs at speed. Do not drive it for extended distances in limp-in; it is easy to overheat the trans if you run in limp-in. Restarting the engine will clear the limp-in condition (as long as the solenoid circuit keeps working OK).
The PCM periodically (every 10 seconds, I think) checks the continuity of each of the main clutch solenoid coils. There are six of these solenoids (LR, UD, OD, 2C, 4C, and MS). To check each solenoid, the PCM briefly changes the state (turns it off if it was on, or on if it was off), and then turns it back to its original state. When each solenoid is on, it develops a magnetic field around the solenoid coil. When the current is turned off, this magnetic field collapses, which induces a short voltage spike on the solenoid wire. The PCM monitors the voltage on the solenoid wire, after it turns the solenoid off, and watches for this induced spike. If it fails to see the spike, it repeats the test. After I think 3 successive failures, it sets the related fault code (for the UD solenoid, P0765) and puts you into limp-in.
Now there are basically three different problems that can cause a solenoid circuit fault:
• Solenoid coil is open (broken coil wire)
• Wiring between solenoid and PCM is bad (open, or shorted into another wire)
• Solenoid driver chip in PCM is bad (either not activating the solenoid properly, or not recognizing the voltage spike)
The problem is in tracking down which one of these is the real root cause. I would suggest you first try simply disconnecting (and reconnecting) the trans wiring harness. Sometimes the connection on one of the pins gets flaky, and simply unplugging it and then reseating it fixes the issue. So disconnect the harness at both ends (trans and PCM), inspect the connectors (look for bent pins, pins that are pushed part-way back into the connector, water or other contamination, corrosion, etc.), and then re-connect.
Make sure the key is OFF when you pull the connectors. On the PCM, there should be four (4) identical main connectors. The trans harness is the 4th connector (so it will be one of the end ones), and usually has a green stripe or mark on or next to the connector.
The main transmission electrical harness is on the driver's side of the trans. The 23-pin connector is on the solenoid / valve body and sticks vertically up out of the trans, a few inches above the oil pan rail.
The harness connector has a locking lever and a secondary latch. The transmission side of the connector is square and has two small round posts sticking out of opposite sides of the connector (one towards the front of the vehicle, one towards the rear). The locking lever on the harness (which is probably gray in color) wraps around three sides of the connector. The latch is on the driver's side. The two sides that wrap around have slots that engage with the two posts on the transmission connector. When the connector is unplugged, the locking lever (latch side) is down (toward the open end of the harness). When you plug it into the trans, the slots engage with the posts. Then, you push the locking lever latch bar up, which rotates the locking lever and clamps the harness connector down into the trans connector (by grabbing and pulling on those posts). I know this is hard to visualize... sorry but I don't have a picture.
To disconnect the harness, you first need to release the secondary lock. This is typically a red plastic piece (on the driver's side of the connector, just below the locking lever latch bar, which will be at the TOP of the connector when it's locked). You'll need to slide this red secondary lock either up or down (I'm not sure which, probably down but I'm not positive) before you can unlock the lever. Once that's done, reach up above and behind the center of the locking lever. The latch that holds the locking lever is just behind the face of the center of the locking lever (there's about 1/4 inch space between them). Put your finger behind the face of the locking lever, and push it and the latch APART. You need to push the latch (the piece just behind the top of the locking lever) in, towards the transmission (away from the locking lever) in order to release it. Once the locking lever pops free, rotate it down as you lift the harness up and off.
When you go to re-connect it, make sure the locking lever is DOWN (towards the open end of the harness connector) so it will engage the posts on the trans connector, then plug it in and rotate the locking lever up til it latches. Then slide the secondary lock into position to retain it.
If unplugging the harness fixes things, you're home free. If you still have issues, post again and I can give you details on how to troubleshoot further.