2004 Dodge Stratus • 144,000 miles

As I was drving my car it turned off and as it did that thr rpm went up to 1000 rpm to 2000 rpm and then it shut off. I was driving at a speed of 25mph and after I let go of the accelerator that happened and it shut off. Car wont start now. I scaned it and got a p0340 code. I already changed the crankshaft and camshaft position senors. I also checked the wiring. Could it be the pcm. I also changed that but I baught the pcm at a junkyard but it still wouldnt start. Does the pcm have to match the same as the old one? It seems like its not passing gas or its not igniting. Please help.
March 2, 2013.

Check out the related content below while we wait for the question to be answered by a professional mechanic.