serial plot issues

Hi

I am using atmega2560 to sample 50hz sine signal (at 1KHz) and plot it . The plot works fine when I print analog read function. I changed the code to take in 20 samples and then out of this loop print those 20 samples. To my surprise the wave is different from what I saw earlier. Why is it so? Snippet of my code below:

unsigned long curr, end;
void loop()
{
curr = micros();
if(curr - end >= 1000) // 1KHz sample
{
end = micros();
if(n<20)
{
value[n]=analogRead(analogInPin); //accumulate 20 samples - 20ms
n++;
}
else if (n==20) // plot samples after acquisition
{
for (n=0;n<20;n++)
{Serial.println(value[n]);} //Waveform in wierd
n=0;
}
}

Snippet of my code below:

Please post the whole program or a full cut down version that shows the problem.

Post all the code inside tags please,

Well this is the code. Nothing extra. Only analog pin is defined as A0

Well this is the code.

No. It is SOME of it. Where, in the snippet you posted, is the value array declared?

Yes array was declared as unsigned int values[30].

If you are going to post only some of your code, I'm only going to post some of my answer.

The values you are now sending are not equally spaced, time...