FreqMeasurecapture.h porting to arduino 101

Status
Not open for further replies.

MarcLaos

New member
I want to try to adapt the FreqMeasure libary to use with the Intel 101 Curie board.
Can anybody help or give me some input (i am quit new to arduino)

Thanks
 
You'll have to study the Intel 101 Curie processor reference manual to find out if this one has a similar timer hardware for input capture. Then, you'd have to add the corresponding code and the cpu related #ifdefs to /utils/FreqMeasurecapture.h
 
Did Intel ever publish Curie hardware specs? I don't recall ever seeing a manual or datasheet like we have for regular microcontrollers, where the timers and all the registers are fully explained and documented.
 
Looks like there exists a CurieTimerOne library which gives similar access as the TimerOne does for the AVR timers. Perhaps there are hints for capturing inputs.

But since this is not directly Teensy related, I'd suggest that MarcLaos digs into that by himself.
 
Thanks.
Indeed Intel will not continue the curie.
I am using the powerfull UDOO X86 running windows 10 board with the Intel curie integrated.

this will do the job i guess:

volatile byte count = 0;
byte numCount = 25; //number of pulse intervals to measure


volatile unsigned long startTime;
volatile unsigned long endTime;
unsigned long copy_startTime;
unsigned long copy_endTime;

volatile boolean finishCount = false;
float period;

unsigned int rpm = 0;

void setup()
{
Serial.begin(115200);
Serial.println("start...");
//pinMode(2, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(2), isrCount, RISING);//interrupt on pin2
}

void loop()
{
if (finishCount == true)
{
finishCount = false;//reset flag
// disable interrupts, make protected copy of time values
noInterrupts();
copy_startTime = startTime;
copy_endTime = endTime;
count = 0;
interrupts();

period = (copy_endTime - copy_startTime) / 1000.0; //micros to millis
//debug prints
//Serial.print(period); //total time for numCount
//Serial.print('\t');
//Serial.println(period/numCount);//time between individual pulses

rpm = numCount * 60.0 * (1000.0 / period);//one count per revolution
//rpm = numCount * 30.0 * (1000.0 / period);//two counts per revolution

Serial.print("RPM = ");
Serial.println(rpm);
}
}


void isrCount()
{
if (count == 0)//first entry to isr
{
startTime = micros();
}

if (count == numCount)
{
endTime = micros();
finishCount = true;
}
count++; //increment after test for numCount
}
 
Status
Not open for further replies.
Back
Top