Page MenuHomec4science

tachometer.h
No OneTemporary

File Metadata

Created
Mon, May 13, 05:42

tachometer.h

#ifndef __TACHOMETER_H
#define __TACHOMETER_H
#include "../main.h"
#include "adc.h"
#define TAC_RPM_TO_VOLTAGE 0.00052f // According to the Maxon DC Tacho DCT 22 datasheet [V/RPM].
#define TAC_VOLTAGE_TO_RPM (1/TAC_RPM_TO_VOLTAGE) // [RPM/V].
/** @defgroup Tachometer Driver / Tachometer
* @brief Driver for a tachometer.
*
* This driver uses an ADC input, ANIN1 or ANIN2 (see ADC).
* To use this, connect wire the sensor as this:
* * tacho 1 -> ANINX+ (pin 3 or 7 of J2).
* * tacho 2 -> ANINX- (pin 4 or 8 of J2).
*
* Set the sensitivity switches to +-2V.
*
* Call tac_Init() first in the initialization code. Then, call tac_Get() to
* get the motor speed.
*
* @addtogroup Tachometer
* @{
*/
void tac_Init(AdcChannel channel);
float32_t tac_Get(void);
/**
* @}
*/
#endif

Event Timeline