A Eureka Moment!

liudr:
Just wondering what values you set your D to. Most of the time, a non-zero D leads to jittery responses since it draws from the change of values over short period of time. I usually only use P and I and only use D if the single is relatively clean and I need a faster response.

I did not implement a D term in my code. One of my causes of erratic behaviour was overflow of a variable to a negative number - newbie errors. Also poor resolution was not helping - initially I went to a float variable but kept getting ovf in the result - then I changed to long, and use a x10 multiple and this worked - I still dont understand why float would not work.

PS: crOsh: I still stand by my assertion that the language used to program the Arduino is a 'sketch' and not C. Although it uses much of the C language there are many Arduino specific terms which are not in any C definition that I know of. It is misleading to call it C. I am still working my way through all the Arduino specific stuff.