Here are some methods:
Elliptical Spring here by Mike
How to Animate a Spring here by Ben
Here is a methid using eqautions:
Here is the method using a macro:
I posted a method on GrabCad that maintains the tangential relationship throughout the length of the spring. All the others that I have seen thus far (and I haven't gone through Deepak's list above yet) have rigid ends and do not keep the wire length constant. So I think the one below is possibly the best around. It is more complicated to set up and animate than others, and I have not had time to write up an explanation, so you would have to go through the model that I provided.
Best of luck!