Midnight Sun Firmware
Loading...
Searching...
No Matches
current_acs37800_defs.h
1#pragma once
2
3/************************************************************************************************
4 * @file current_acs37800_defs.h
5 *
6 * @brief Current Sensor ACS37800 Defs
7 *
8 * @date 2025-07-30
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13
14/* Inter-component Headers */
15
16/* Intra-component Headers */
17
24// Table value formula, NEED the Rsense and Riso resistor values for line voltage calculation
25#define VOLTAGE_SCALE ((0.84 * 1.19) / 32768.0)
26
27#define CURRENT_SCALE ((0.84 * 1.19) / 32768.0)
28#define POWER_SCALE ((0.704 * 1.42) / 32768.0)
29
30// register map is on pg.38
31// https://www.allegromicro.com/-/media/files/datasheets/acs37800-datasheet.ashx
32typedef enum {
33 ACS37800_REG_VRMS_IRMS = 0x20, // Voltage and Current RMS
34 ACS37800_REG_VCODES_ICODES = 0x2A, // Voltage and Current Instantaneous
35 ACS37800_REG_PINSTANT = 0x2C, // Power Instantaneous
36 ACS37800_REG_PACTIVE_PIMAGE = 0x21, // Active & Reactive Power Output
37 ACS37800_REG_PAPPARENT_PFACTOR = 0x22, // Apparent power & Power factor output
38 ACS37800_REG_NUMPTSOUT = 0x25, // number of points for RMS calculation
39 ACS37800_REG_VI_RMSAVGONESEC = 0x26, // Voltage & Current average RMS (seconds)
40 ACS37800_REG_VI_RMSAVGONEMIN = 0x27, // Voltage & Current average RMS (minutes)
41 ACS37800_PACTAVGONESEC = 0x28, // Power average RMS (seconds)
42 ACS37800_REG_PACTAVGONEMIN = 0x29, // Power average RMS (minutes)
43 ACS37800_REG_STATUS = 0x2D // ZEROCROSSOUT, OVERVOLTAGE, UNDERVOLTAGE, FAULTOUT, FAULTLATCHED
44} ACS37800_Registers;
45