i unhooked the battery a few times so i don't think i have any codes.i replaced the crankshaft position sensor and it still acts like it is out of time it will crank over and stop sometimes it will backfire out the throttle body.i guess it has spark now because it acts like it wants to start sometimes but not all the time seems like the timing is way out of whack somehow.
Did you replace the one on the distributor, also? There are two sensors. You'll eventually get a P1345 code IIRC if this is your problem. I'd also do an idiot check, and just unsnap/resnap the harnesses on the distributor. When you disconnected the battery, did you let it sit for a couple minutes? Try that too, although you will lose some of the codes, if not all.
Are you sure you're getting fuel? My experience (and humble $0.02) is that electrical problems I've had with our rigs have caused poor running for a short period of time, and then failure, whereas fuel problems have been immediate, and brutal. Instant death, and no codes was the fuel pump for me.
Best of luck to you, sir!!
Edit: Definitive troubleshooting steps- Have a buddy help you. Pull a spark plug wire off, hold the plug wire end close to the plug and crank it over. If you see a spark jumping across, you've got spark. You'll probably shock the crap out of your hand, too, but it won't kill you. Just a little kiss from your hoe. No spark- could be a number of things, but any one of them should throw a code. If you have spark, when you first turn the key to 'on,' you should hear the fuel pump whine/engage for 2 seconds, then stop. If you don't hear it, your fuel pump pooped the bed. If you have spark to the plugs, and a good fuel pump, then your timing is hosed- go for the other crank position sensor on the distributor? Look for more codes?