Camshaft Sensor Trouble

My car randomly stalled the other day. I turned it on and my Check Engine Light was one. It gave me the code "P0340 Camshaft Position Sensor Circuit Malfunction." I replaced this with an Autozone part which I was advised against after I had already done it. My car is still randomly stalling and giving this code. I have tried the IAC cleaning and that didn't work.

What could be the problem? Do you think that if I replace the sensor with an OEM part it would work better? This is sort of pissing me off now because my car randomly dies and randomly revs. Any help would be greatly appreciated. Also, my speedometer sensor has died. I am replacing that tomorow also. I don't know if this could help at all.

Thanks
 
P0340, i really hate that code :mad: i replaced the sensor twice to no avail, so after a long and hard internet search, a few clues pointed to the regulator which really didn't make much sense but i told the mechanic to check it anyway, and it turns out that was the cause. maybe the same thing might be happening to your car
 
My check engine light was going off and I checked it out with my predator and it came back that the camshaft positions sensor was bad. I replaced it and it no problems for a month or two and then recently it went off again. I cleared the fault code and it went off and now i haven't had a code in about 2 weeks. wtf?
 
I really need to know what regulator. I'm having the exact same problem. Please help.

I aleady replaced the sensor. The alternator is putting out the correct voltage.

I also heard it could be the pcm. What is the pcm and how can I diagnose it.


Thanks a lot.