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

Committer:
gert_lauritsen
Date:
Tue Nov 19 09:19:01 2013 +0000
Revision:
4:35024179a736
Parent:
3:6d3f2034e5f1
Child:
5:451dd1189b0f
Ver 1.0 tarco. ; Kan ikke rigtigt lave missing puls detect

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 2:c50da089786a 5
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 2:c50da089786a 14 int AdvPeriode;
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 2:c50da089786a 19 public:
gert_lauritsen 2:c50da089786a 20 // ********************************************************************************
gert_lauritsen 4:35024179a736 21 // Constructor
gert_lauritsen 4:35024179a736 22 // @param flowsignal The pin which is connected to the flowsensor.
gert_lauritsen 4:35024179a736 23 //
gert_lauritsen 4:35024179a736 24 // change the mode of the tarco
gert_lauritsen 4:35024179a736 25 // 0: Standard One click/rotation
gert_lauritsen 4:35024179a736 26 // 1: FSK modulated
gert_lauritsen 2:c50da089786a 27 // ********************************************************************************
gert_lauritsen 4:35024179a736 28 Tarco(PinName tarcosignal,char mode);
gert_lauritsen 4:35024179a736 29
gert_lauritsen 3:6d3f2034e5f1 30 // ********************************************************************************
gert_lauritsen 3:6d3f2034e5f1 31 // gives the tarco value in hz
gert_lauritsen 3:6d3f2034e5f1 32 // ********************************************************************************
gert_lauritsen 3:6d3f2034e5f1 33
gert_lauritsen 2:c50da089786a 34 float Speed();
gert_lauritsen 3:6d3f2034e5f1 35 // ********************************************************************************
gert_lauritsen 3:6d3f2034e5f1 36 // gives the tarco value in rotation pr min
gert_lauritsen 3:6d3f2034e5f1 37 // ********************************************************************************
gert_lauritsen 3:6d3f2034e5f1 38
gert_lauritsen 2:c50da089786a 39 float RPM();
gert_lauritsen 2:c50da089786a 40 };
gert_lauritsen 2:c50da089786a 41
gert_lauritsen 2:c50da089786a 42 #endif