Ultima versão da banca de ensaios BMS Fev2017

Dependencies:   CANnucleo LTC68041 mbed

Fork of BMS_4 by Gerardo Antonio

Revision:
46:9bc58ec85bd5
Parent:
45:9764758d3433
Child:
47:5c05c55d61ac
--- a/main.cpp	Tue Nov 29 11:20:16 2016 +0000
+++ b/main.cpp	Tue Nov 29 13:14:54 2016 +0000
@@ -459,7 +459,16 @@
             to_send=0;
             //-----------------1º send cell voltages
             
-            if(cells_left>0){
+//------------------------------  
+            if(cells_left>0){                
+if(cells_left==1||cells_left==2||cells_left==3||cells_left==4||cells_left==5||cells_left==7||cells_left==8||cells_left==9||cells_left==10){
+    if(cell_codes[0][cells_left-1]<38000||cell_codes[0][cells_left-1]>42000){
+        __disable_irq();    // Disable Interrupts
+         alarm('v');
+        __enable_irq();
+        }
+    }
+//------------------------------          
             
             txMsg.clear();
             txMsg.id = 11;     //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13.
@@ -482,9 +491,7 @@
   //          wait_ms(200);      falha se houver aqui um delay deste tamanho 
        
        if(temps_left>0){
-       
 //------------------------------
-
 if(temps_left==1||temps_left==2||temps_left==3||temps_left==4||temps_left==5||
 temps_left==6||temps_left==7||temps_left==8||temps_left==9||temps_left==10||
 temps_left==11||temps_left==12||temps_left==15||temps_left==31){
@@ -495,8 +502,6 @@
         __enable_irq();
         } 
     }
-
-
 //------------------------------            
             txMsg.clear();
             txMsg.id = 21;     //BMS1=>ID:21; BMS2=>ID:22; BMS3=>ID:23.