I don't understand. FreqCount is still included with the installer. Its 3 examples should still be in the Examples menu.
Not sure what timing constraint you're talking about. On each Teensy model, that library can count at fast as the external clocking of hardware timers allows.
@Paul
Thank you for replying to my query.
My system consists of :
Teensy 4.1 plus custom PC board and touchscreen.
Windows 10 PC
Recently installed Arduino 1.8.15 and Teensyduino 1.56-beta1
The Library manager indicates I have FreqCount 1.3.0
I see no FreqCount() examples.
My application includes a frequency meter for RF purposes up to 60 MHz with a programmable gate period the user can set to any decade value between 10uSec and 10Sec. The input buffering is achieved with a high speed Schmidt trigger and some other routing. The input to the T4.1 is full amplitude and nice and clean.
The Teensy FreqCount function works well when tested with the original sample code but gives strange results when the period between measurements is made longer than the gate period. The interval between measurements should not influence the value of the measurement.
With a gate time of 1000 uSec and a delay of 13mSec simulating the other functions a 10MHz input displays 13,0001. (Error)
With a gate time of 1000 uSec and a delay of 900uSec simulating the other functions a 10MHz input displays 10,000. (Correct)
The attached code clearly shows the problem I'm experiencing, please see the comments.
Regards,
RichardL
PS: I tried an alternative to delayMicroseconds() just in case that was causing a conflict; no change.
Code:
#include <FreqCount.h>
long FCount;
// Frequency measurement gate time which is
// user configurable between 10uS to 10Sec.
long GateTime = 1000; //Ex: 1000 for a 1mSec gate
// uSec taken by several other functions, SD card buffer writes, serial, etc.
// Typically in range 5 to 15 mSec.
long SimTime = 13000; // Ex: 13000 for a 13mSec aggregate delay
// What I see...
// With any input frequency between 1MHz and 25MHz. Broadly:
// If SimTime > GateTime the value of FCount is in error and looks
// like the gate period is controlled by SimTime.
// If GateTime > SimTime FCount value is OK.
void setup() {
Serial.begin(57600);
FreqCount.begin(GateTime); // Gate time is in uSec
}
void loop() {
delayMicroseconds(SimTime); // Simulates lots of other things happening.
// MyDelay(13);
if (FreqCount.available()) {
FCount = FreqCount.read();
Serial.println(FCount);
}
}
void MyDelay(long WaitTime){
unsigned long ExitTime = millis() + WaitTime;
while (millis() < ExitTime){};
}