ninja2
Well-known member
I've been playing with the Serial_Output_T4 example sketch in the FreqCount library, on a T4.1
As provided the sketch reports exxactly 50MHz on pin 9, as expected.
However other frequency values don't give expected results
Requesting 40MHz reports 37.5 MHz
Requesting 10MHz reports 10 MHz
Requesting 4MHz reports 3.947368 MHz
I'm wondering what the issue is?
Also, what is purpose of this line? :
As provided the sketch reports exxactly 50MHz on pin 9, as expected.
However other frequency values don't give expected results
Requesting 40MHz reports 37.5 MHz
Requesting 10MHz reports 10 MHz
Requesting 4MHz reports 3.947368 MHz
Code:
#include <FreqCount.h>
void setup() {
Serial.begin(57600);
delay(2000);
//alogWriteFrequency(8, 40000000); // 40MHz - reports 37.5 MHz
//alogWriteFrequency(8, 4000000); // 4MHz - reports 3.947368 MHz
analogWriteFrequency(8, 10000000); // 10MHz - works fine
//alogWriteFrequency(8, 50000000); // 50MHz - works fine
analogWrite(8, 128);
FreqCount.begin(1000000); //Time in microseconds
}
void loop() {
if (FreqCount.available()) {
unsigned long count = FreqCount.read();
Serial.println(count);
}
}
Also, what is purpose of this line? :
Code:
analogWrite(8, 128);