Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:9d8518740e5c, committed 2019-05-08
- Comitter:
- gscuttari
- Date:
- Wed May 08 19:36:00 2019 +0000
- Parent:
- 0:6a895c900427
- Commit message:
- ML
Changed in this revision
| bms.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6a895c900427 -r 9d8518740e5c bms.h
--- a/bms.h Mon Apr 15 10:20:43 2019 +0000
+++ b/bms.h Wed May 08 19:36:00 2019 +0000
@@ -62,6 +62,7 @@
char VMON_DATA_WRITE[] = {0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A , 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
int STATE_OF_BMS;
+int STATE_OF_BMS_PREC;
double VIM0;
double VIM1;
double VR;
@@ -69,17 +70,19 @@
double Vimz;
double Vimon;
double Isense;
-double V_ref = 3.4f;
+double V_ref = 3.3f;
double Rsense = 0.003f;
bool schort_circuit_detection = false;
double instant_current_detected;
-float LOWVOLTAGEWARNING = 34.0; // Define low voltage warning
-float LOWVOLTAGECUTOFF = 33.0; // Define low voltage cut off
-float HIVOLTAGESHUNT = 3.8; // Define high voltege limit for balancing
+float LOWVOLTAGEWARNING = 35.0; // Define low voltage warning 35
+float LOWVOLTAGECUTOFF = 34.0; // Define low voltage cut off
+float HIVOLTAGESHUNT = 3.9; // Define high voltege limit for balancing
float VOLTAGEALLOWANCE = 0.009; // Define the accuracy the balancing algorithm can balance it to.
-float HIGHVOLTAGECUTOFF = 39.0; // Define high voltage cut off
-int TOTALCELLS = 16; // Number Of cells
+float HIGHVOLTAGECUTOFF = 39.00; // Define high voltage cut off
+float LOWVOLTAGEPOWERDOWN = 31.0; // Define low voltage to put BMS in POWER_DOWN_MODE
+
+int TOTALCELLS = 10; // Number Of cells
float voltageHighest;
@@ -97,21 +100,21 @@
float temp_min = -5;
float temp_warning = 40;
float temp_cutoff = 60;
-float thr_val=0, thr_res=0, temperature=0;
+float thr_val=0, thr_res=0, temperature=0, temperature_of_battery=0;
unsigned char read_buf,read_buf2,read_fet, read_power, rdata;
double gain_correction = 0;
-
+//**********************************************************************************************
// Status flags READ ONLY
-bool DF_STATUS = false; // Mosfet OUT
-bool CF_STATUS = false; // Mosfet CHARGER
-bool PSW_STATUS = false; // Power safe mode
-bool INT_STATUS = false; // INT bit indicates the /INTO pin output status.
+bool DF_STATUS = false; // Mosfet OUT
+bool CF_STATUS = false; // Mosfet CHARGER
+bool PSW_STATUS = false; // Power safe mode
+bool INT_STATUS = false; // INT bit indicates the /INTO pin output status.
bool RPSL_STATUS = false; // RPSL bit indicates interrupt status of charger disconnecting interrupt if charge over-current detected.
bool RPSH_STATUS = false; // RPSH bit indicates interrupt status of charger disconnecting interrupt if the status is power down.
-bool RRS_STATUS = false; // RRS bit indicates interrupt status of load disconnecting interrupt
-bool RSC_STATUS = false; // RSC bit indicates interrupt status of short current detecting interrupt.
-
+bool RRS_STATUS = false; // RRS bit indicates interrupt status of load disconnecting interrupt
+bool RSC_STATUS = false; // RSC bit indicates interrupt status of short current detecting interrupt.
+//***********************************************************************************************
// status flags of power status
@@ -131,13 +134,14 @@
void handle_interrupt();
void read_instant_current();
-float read_temperature_of_battery();
+void read_temperature_of_battery();
void events_of_bms();
void actions();
float vTotal();
int highestCell();
int lowestCell();
float average_voltage();
+void powerdown();