24 #ifndef BMS_BASIC_TEMP_MCP9843_H_ 25 #define BMS_BASIC_TEMP_MCP9843_H_ 32 #define TWI_BAUDRATE 100000 33 #define TWI_BAUDSETTING TWI_BAUD(F_CPU, TWI_BAUDRATE) 34 #define TWI_TEMPERATUR_MASTER_PORT PORTE 35 #define TWI_TEMPERATUR TWIE 40 #define MCP9843_BASE_ADDR 0x18 50 #define EEPROM_1 ( EEPROM | (1<<MCP9843_A0) ) 55 #define SHDNStatus_bm 0x80 56 #define tOUT_Range_bm 0x40 58 #define Resolution_bm 0x18 60 #define Accuracy_bm 0x02 66 #define MCP9843_CAP_REG 0x00 67 #define MCP9843_CONFIG_REG 0x01 68 #define MCP9843_TUPPER_REG 0x02 69 #define MCP9843_TLOWER_REG 0x03 70 #define MCP9843_TCRIT_REG 0x04 71 #define MCP9843_TEMP_REG 0x05 72 #define MCP9843_MANUFACTURER_ID_REG 0x06 73 #define MCP9843_DEVICE_ID_REG 0x07 74 #define MCP9843_RESOLUTION_REG 0x08 80 #define MCP9843_CONF_INT_CLEAR_LSB_bm 0x16 81 #define MCP9843_CONF_INIT_ALL_LSB_bm 0x01 82 #define MCP9843_CONF_INIT_TCRIT_LSB_bm 0x05 83 #define MCP9843_CONF_RESET_EVENT_LSB_bm ( MCP9843_CONF_INT_CLEAR_LSB_bm | MCP9843_CONF_INIT_TCRIT_LSB_bm ) 86 #define MCP9843_CONF_HYST_00_MSB_bm 0x00 87 #define MCP9843_CONF_HYST_15_MSB_bm 0x02 88 #define MCP9843_CONF_HYST_30_MSB_bm 0x04 89 #define MCP9843_CONF_HYST_60_MSB_bm 0x06 94 #define MCP9843_RES_MED_bm 0x02 95 #define MCP9843_RES_HIGH_bm 0x03 126 #define MCP9843_TCRIT_MSB 0x02 127 #define MCP9843_TCRIT_LSB 0x00 128 #define MCP9843_TUPPER_MSB 0x01 129 #define MCP9843_TUPPER_LSB 0xE0 130 #define MCP9843_TLOWER_MSB 0x00 131 #define MCP9843_TLOWER_LSB 0x00 136 #define MCP9843_BASE_VALUE 0.0625 141 #define MCP9843_TEMPERATURE_FLT_bm 0x1FFF 142 #define MCP9843_TEMPERATURE_SGN_bm 0x1000 143 #define MCP9843_TEMP_GT_TCRIT_bm 0x8000 144 #define MCP9843_TEMP_GT_TUPPER_bm 0x4000 145 #define MCP9843_TEMP_LT_TLOWER_bm 0x2000 149 extern uint8_t sendRegData[];
153 extern bool tcrit_flag[];
154 extern bool tupper_flag[];
155 extern bool tlower_flag[];
160 extern void determineTemp (
void );
162 int mcp9843_temp (
void );
167 #endif //BMS_BASIC_TEMP_MCP9843_H_ void MCP9843_init()
Einstellungen des µC für die Arbeit mit MCP9843.
void MCP9843_config(unsigned char Sensor_Nummer)
Standardeinstellungen des Sensors einstellen.
void mcp9843_get_data(void)
Die Daten des Temperatursensors werden ausgelesen.
XMEGA TWI master driver header file.
TWI master driver struct.
int mcp9843_calculate_value(uint16_t bitcode)
Messwert berechnen und Zweier-Komplement-Berechnung starten.
TWI_Master_t twi_TEMP_RTC
TWI (I2C) Mastervariable, steuert die Register und speichert Daten.