you say you have a 1997 model TJ
therefore first thing is to retrieve any diagnostic codes. below is what I copied elsewhere
To get the codes from your TJ:
Turn the ignition key ON THREE TIMES in succession:
ON : OFF : ON : OFF : ON
(within FIVE seconds)
Count the number of times the check engine lamp on the dash flashes. The number of flashes represents the error code. There will be a short pause between the flashes representing the different digits of the code. Longer pauses separate individual trouble codes. Codes on 1999 and newer TJs will be displayed in the odometer.
Code 55 will be the last code to be displayed.
Note: This does not work on most '98 and '99 models due to changes in the OBD system during that year
for more details see here with what the code numbers represent http://www.jeepforum.com/forum/f9/fa...r-codes-23788/
and I'm leaning towards a crank position sensor, but impossible to tell from here