fighting check engine light
Vehicle is 1995 ford ranger,4.0 v6 pushrod engine. I bought it new and it is still in very good condition with only 73k on the clock.
problem is a PO340 code that I can't seem to fix. It is the cam position sensor code. This particular vehicle has the one piece sensor with the electrical connector that points up rather than flat. I had noticed for some time before that there was a chirping sound that I could hear in cold weather until the engine would warm up. That turned out to be the synchronizer on the sensor that was going bad.
After a lot of looking I finally found a sensor. It was a rebuilt one but it seems fine.
I installed the new sensor last winter and set it according to the directions in the Haynes Manual. It says to set the No.1 cylinder to TDC compression--set trailing edge of sensor vane to left mark in sensor window and install synchronizer shaft until it contacts gear on rear of cam. Then set engine to 26 degrees ATDC and turn sensor counterclockwise until there is a voltage reading and then tighten the hold down bolt. After all of this I removed the code with a code reader only to have it come on later and showing the same code.
Now the weird part. The light will go out from time to time. If seems go out if the weather is warm and If I drive it around a 100 miles. It will go out for no reason and work properly for the rest of the day only to come on the next day. It will stay on until I drive it at least 100 miles again and the whole thing starts over again.
I have checked my work 3 times now and Its set correctly according to the Haynes manual. I checked the output voltage from the sensor right at the point where it goes into the connector that plugs into the pcm so I'm pretty sure the wiring is ok.
I would appreciate any help or suggestions anyone can give me
Sorry about the length but I thought it all pertains to the problem
Thanks



