Hi all,

Having a tuning issue with my Arduino mega2560 running the attached sketch.

Note: this sketch ran OK with Arduino Uno.

```
int Pwmpin = 11 ; //Pwm Output Pin
int Fchange = A0; //Frequency change through Potentiometer
void setup()
{
pinMode(Pwmpin, OUTPUT);
TCCR1A = _BV(COM1A1) | _BV(COM1B1); //Non-inverted Mode
TCCR1B = _BV(WGM13) | _BV(CS11); //Prescalar 8
}
void loop()
{
float frequency = 440 + (analogRead(A0) * 0) / 1024;
uint16_t TOP = ((F_CPU / 8) / (frequency * 2)) - 1;
ICR1 = TOP;
OCR1A = TOP / 1.5;
}
```

I checked the frequency with a chromatic tuner.

The result was 4 to 5 hz low (flat).

For maths convenience i selected 4.4 hz.

my calculation is as follows:

4.4/440 x 16,000,000 = 160,000 hz

I then checked the clock using the Fade sketch.

The result was 495 to 496 milli hz. 4 to 5 milli hz low.

Again for maths convenience i selected 5 milli hz

my calculation is as follows;

5/500 x 16,000,000 = 160,000 hz.

Both suggest the clock is +/- 10,000 ppm , in this case minus.

If my maths is right , then the clock is kaput.

Any thoughts?