The distributor gear is off by 1 tooth, you probably recently have a a timing belt.
camshaft position sensor fault
Yes, if it works some times and some times not.
p1039 for a 1999 ford ranger indicates a camshaft position sensor fault. it could be the sensor, wiring, or the PCM. must be properly diagnosed to determine the real fault.
Code 54-No cam signal at the PCM-No camshaft position sensor signal detected during engine cranking.
OBD 0068 indicates a fault in the MAP throttle position sensor.0068 indicates a fault in the MAP throttle position sensor.
On my 1999, I'm pretty sure the cam and the crank sensor will generate the same fault code. For the price of the sensors, I'd just change both. Eliminate any doubt about which one is at fault.
Indicates a fault with the camshaft position sensor circuit. Either the sensor itself, or the wiring for it is faulty. If it occurs after replacing heads or engine assembly, check to make sure it is plugged in completely and that no damage was done to wiring harness.
Trouble code P1345 means: Camshaft To Crankshaft Position Correlation Fault
Trouble code P1345 means: Camshaft To Crankshaft Position Correlation Fault
P0340 would seem to relate to a fault with the camshaft position sensor, or related wiring. It is also worth noting that a badly worn (IE stretched) cam-chain could also cause this fault code to come up. This would normally be accompanied by excessive engine noise (Rattling from the chain).
Knowing what the problem is and rectifying it are two different things. You need to speak to a mechanic or a dealership to determine your best course of action.
camshaft/crankshaft position corellation fault