Interface to a standard tarco sensor. Measure the periode and the cal the speed

Committer:
gert_lauritsen
Date:
Tue Nov 19 12:44:26 2013 +0000
Revision:
5:451dd1189b0f
Parent:
4:35024179a736
Child:
6:2ad5029f7b1a
?ndret midling af periode

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gert_lauritsen 2:c50da089786a 1 #include "mbed.h"
gert_lauritsen 2:c50da089786a 2
gert_lauritsen 2:c50da089786a 3 #ifndef _Tarco_H
gert_lauritsen 2:c50da089786a 4 #define _Tarco_H
gert_lauritsen 5:451dd1189b0f 5 #define TarcoRunMean 50
gert_lauritsen 2:c50da089786a 6
gert_lauritsen 2:c50da089786a 7 class Tarco {
gert_lauritsen 2:c50da089786a 8
gert_lauritsen 2:c50da089786a 9 private:
gert_lauritsen 2:c50da089786a 10 InterruptIn _tarcosensor;
gert_lauritsen 4:35024179a736 11 void click(); //Measure the tarco from a one puls /rotation source
gert_lauritsen 4:35024179a736 12 void fsk(); //measure tarco from a fsk source
gert_lauritsen 4:35024179a736 13 int p1,p2;
gert_lauritsen 5:451dd1189b0f 14 int AdvPeriode[TarcoRunMean]; //running mean for tarco
gert_lauritsen 4:35024179a736 15 Timer t; //time for one rotation
gert_lauritsen 4:35024179a736 16 Timer fsktime; //time between fsk pulse
gert_lauritsen 4:35024179a736 17 int pulsvariation, lastpuls, count;
gert_lauritsen 4:35024179a736 18 char tarcomode;
gert_lauritsen 5:451dd1189b0f 19 float lastfrekvens;
gert_lauritsen 2:c50da089786a 20 public:
gert_lauritsen 2:c50da089786a 21 // ********************************************************************************
gert_lauritsen 4:35024179a736 22 // Constructor
gert_lauritsen 4:35024179a736 23 // @param flowsignal The pin which is connected to the flowsensor.
gert_lauritsen 4:35024179a736 24 //
gert_lauritsen 4:35024179a736 25 // change the mode of the tarco
gert_lauritsen 4:35024179a736 26 // 0: Standard One click/rotation
gert_lauritsen 4:35024179a736 27 // 1: FSK modulated
gert_lauritsen 2:c50da089786a 28 // ********************************************************************************
gert_lauritsen 4:35024179a736 29 Tarco(PinName tarcosignal,char mode);
gert_lauritsen 4:35024179a736 30
gert_lauritsen 3:6d3f2034e5f1 31 // ********************************************************************************
gert_lauritsen 3:6d3f2034e5f1 32 // gives the tarco value in hz
gert_lauritsen 3:6d3f2034e5f1 33 // ********************************************************************************
gert_lauritsen 3:6d3f2034e5f1 34
gert_lauritsen 2:c50da089786a 35 float Speed();
gert_lauritsen 3:6d3f2034e5f1 36 // ********************************************************************************
gert_lauritsen 3:6d3f2034e5f1 37 // gives the tarco value in rotation pr min
gert_lauritsen 3:6d3f2034e5f1 38 // ********************************************************************************
gert_lauritsen 3:6d3f2034e5f1 39
gert_lauritsen 2:c50da089786a 40 float RPM();
gert_lauritsen 2:c50da089786a 41 };
gert_lauritsen 2:c50da089786a 42
gert_lauritsen 2:c50da089786a 43 #endif