![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
all bms comunicating with nucleo board and balancing
Dependencies: CANnucleo LTC68041 mbed
Fork of BMS_2 by
Diff: main.cpp
- Revision:
- 34:8f92a17c5be9
- Parent:
- 33:54861cd567cd
- Child:
- 35:117a807c481a
--- a/main.cpp Wed Nov 09 10:13:51 2016 +0000 +++ b/main.cpp Wed Nov 09 11:13:56 2016 +0000 @@ -9,7 +9,7 @@ uint16_t cell_codes[TOTAL_IC][12]; //uint16_t temp_codes[32]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; -uint16_t temp_codes[32]; +float temp_codes[32]; volatile bool msgAvailable = false; volatile bool to_send = false; @@ -252,6 +252,19 @@ DigitalOut MUXB_2(PB_14); DigitalOut MUXB_3(PB_15); + +void check_temperatures() +{ + float meas; + int i=14; + MUXA_3=1; MUXA_2=1; MUXA_1=1; MUXA_0=0; //(escolha do NTC on board) + meas = MUXA_Read.read(); + temp_codes[i]=meas; + temps_left = 14; +} + + +/* void check_temperatures() { for (int i=0; i<32; i++){ @@ -330,7 +343,7 @@ } temps_left = 32; } - +*/ void onMsgReceived() { msgAvailable = true; @@ -434,16 +447,20 @@ //-----------------2º send cell temperatures txMsg1.clear(); txMsg1.id = 21; //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13. - txMsg1.len = 3; + txMsg1.len = 5; - data2.i[0] = temp_codes[temps_left-1]; + data2.f[0] = temp_codes[temps_left-1]; + txMsg1.data[0] = data2.bytes[0]; txMsg1.data[1] = data2.bytes[1]; - txMsg1.data[2] = temps_left; - temps_left--; + txMsg1.data[2] = data2.bytes[2]; + txMsg1.data[3] = data2.bytes[3]; + + txMsg1.data[4] = temps_left; + //temps_left--; if(!(can.write(txMsg1))) { //se nao conseguiu transmitir continua a tentar transmitir a tensão dessa celula pec_error(); - temps_left++; + //temps_left++; //to_send=1; } }