![](/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:
- 41:0b05e0109f2e
- Parent:
- 40:4144b3eec060
- Child:
- 42:ca364a2bf162
--- a/main.cpp Wed Nov 09 20:47:02 2016 +0000 +++ b/main.cpp Wed Nov 09 21:44:31 2016 +0000 @@ -258,7 +258,7 @@ DigitalOut MUXB_2(PB_14); DigitalOut MUXB_3(PB_15); - +/* void check_temperatures() { int i=14; @@ -266,88 +266,89 @@ temp_codes[i]= MUXA_Read.read()*3300; temps_left = 32; } +*/ -/* void check_temperatures() { for (int i=0; i<32; i++){ switch (i) { case 0: //ntc 1 //from MUXA - MUXA_3=0; MUXA_2=0; MUXA_1=0; MUXA_0=0; + MUXA_3=0; MUXA_2=0; MUXA_1=0; MUXA_0=0; break; case 1: //ntc 2 - MUXA_3=0; MUXA_2=0; MUXA_1=0; MUXA_0=1; + MUXA_3=0; MUXA_2=0; MUXA_1=0; MUXA_0=1; break; case 2: //ntc 3 - MUXA_3=0; MUXA_2=0; MUXA_1=1; MUXA_0=0; + MUXA_3=0; MUXA_2=0; MUXA_1=1; MUXA_0=0; break; case 3: //ntc 4 - MUXA_3=0; MUXA_2=0; MUXA_1=1; MUXA_0=1; + MUXA_3=0; MUXA_2=0; MUXA_1=1; MUXA_0=1; break; case 4: //ntc 5 - MUXA_3=0; MUXA_2=1; MUXA_1=0; MUXA_0=0; + MUXA_3=0; MUXA_2=1; MUXA_1=0; MUXA_0=0; break; case 5: //ntc 6 - MUXA_3=0; MUXA_2=1; MUXA_1=0; MUXA_0=1; + MUXA_3=0; MUXA_2=1; MUXA_1=0; MUXA_0=1; break; case 6: //ntc 7 - MUXA_3=0; MUXA_2=1; MUXA_1=1; MUXA_0=0; + MUXA_3=0; MUXA_2=1; MUXA_1=1; MUXA_0=0; break; case 7: //ntc 8 - MUXA_3=0; MUXA_2=1; MUXA_1=1; MUXA_0=1; + MUXA_3=0; MUXA_2=1; MUXA_1=1; MUXA_0=1; break; case 8: //ntc 9 - MUXA_3=1; MUXA_2=0; MUXA_1=0; MUXA_0=0; + MUXA_3=1; MUXA_2=0; MUXA_1=0; MUXA_0=0; break; case 9: //ntc 10 - MUXA_3=1; MUXA_2=0; MUXA_1=0; MUXA_0=1; + MUXA_3=1; MUXA_2=0; MUXA_1=0; MUXA_0=1; break; case 10: //ntc 11 - MUXA_3=1; MUXA_2=0; MUXA_1=1; MUXA_0=0; + MUXA_3=1; MUXA_2=0; MUXA_1=1; MUXA_0=0; break; case 11: //ntc 12 - MUXA_3=1; MUXA_2=0; MUXA_1=1; MUXA_0=1; + MUXA_3=1; MUXA_2=0; MUXA_1=1; MUXA_0=1; break; case 12: //ntc 13 - MUXA_3=1; MUXA_2=1; MUXA_1=0; MUXA_0=0; + MUXA_3=1; MUXA_2=1; MUXA_1=0; MUXA_0=0; break; case 13: //ntc 14 - MUXA_3=1; MUXA_2=1; MUXA_1=0; MUXA_0=1; + MUXA_3=1; MUXA_2=1; MUXA_1=0; MUXA_0=1; break; case 14: //ntc 15 - MUXA_3=1; MUXA_2=1; MUXA_1=1; MUXA_0=0; + MUXA_3=1; MUXA_2=1; MUXA_1=1; MUXA_0=0; break; case 15: //ntc 16 - MUXA_3=1; MUXA_2=1; MUXA_1=1; MUXA_0=1; + MUXA_3=1; MUXA_2=1; MUXA_1=1; MUXA_0=1; break; case 16: //ntc 17 //from MUXB - MUXB_3=0; MUXB_2=0; MUXB_1=0; MUXB_0=0; + MUXB_3=0; MUXB_2=0; MUXB_1=0; MUXB_0=0; break; case 17: //ntc 18 - MUXB_3=0; MUXB_2=0; MUXB_1=0; MUXB_0=1; + MUXB_3=0; MUXB_2=0; MUXB_1=0; MUXB_0=1; break; case 18: //ntc 19 - MUXB_3=0; MUXB_2=0; MUXB_1=1; MUXB_0=0; + MUXB_3=0; MUXB_2=0; MUXB_1=1; MUXB_0=0; break; case 19: //ntc 20 - MUXB_3=0; MUXB_2=0; MUXB_1=1; MUXB_0=1; + MUXB_3=0; MUXB_2=0; MUXB_1=1; MUXB_0=1; break; case 20: //ntc 21 - MUXB_3=0; MUXB_2=1; MUXB_1=0; MUXB_0=0; + MUXB_3=0; MUXB_2=1; MUXB_1=0; MUXB_0=0; break; case 21: //ntc 22 - MUXB_3=0; MUXB_2=1; MUXB_1=0; MUXB_0=1; + MUXB_3=0; MUXB_2=1; MUXB_1=0; MUXB_0=1; break; case 22: //ntc 23 - MUXB_3=0; MUXB_2=1; MUXB_1=1; MUXB_0=0; + MUXB_3=0; MUXB_2=1; MUXB_1=1; MUXB_0=0; break; case 23: //ntc 24 - MUXB_3=0; MUXB_2=1; MUXB_1=1; MUXB_0=1; + MUXB_3=0; MUXB_2=1; MUXB_1=1; MUXB_0=1; break; case 24: //ntc 25 - MUXB_3=1; MUXB_2=0; MUXB_1=0; MUXB_0=0; + MUXB_3=1; MUXB_2=0; MUXB_1=0; MUXB_0=0; break; case 25: //ntc 26 - MUXB_3=1; MUXB_2=0; MUXB_1=0; MUXB_0=1; + MUXB_3=1; MUXB_2=0; MUXB_1=0; MUXB_0=1; break; case 26: //ntc 27 - MUXB_3=1; MUXB_2=0; MUXB_1=1; MUXB_0=0; + MUXB_3=1; MUXB_2=0; MUXB_1=1; MUXB_0=0; break; case 27: //ntc 28 - MUXB_3=1; MUXB_2=0; MUXB_1=1; MUXB_0=1; + MUXB_3=1; MUXB_2=0; MUXB_1=1; MUXB_0=1; break; case 28: //ntc 29 - MUXB_3=1; MUXB_2=1; MUXB_1=0; MUXB_0=0; + MUXB_3=1; MUXB_2=1; MUXB_1=0; MUXB_0=0; break; case 29: //ntc 30 - MUXB_3=1; MUXB_2=1; MUXB_1=0; MUXB_0=1; + MUXB_3=1; MUXB_2=1; MUXB_1=0; MUXB_0=1; break; case 30: //ntc 31 - MUXB_3=1; MUXB_2=1; MUXB_1=1; MUXB_0=0; + MUXB_3=1; MUXB_2=1; MUXB_1=1; MUXB_0=0; break; case 31: //ntc 32 - MUXB_3=1; MUXB_2=1; MUXB_1=1; MUXB_0=1; + MUXB_3=1; MUXB_2=1; MUXB_1=1; MUXB_0=1; break; } wait_ms(10); //tempo para a tensao á saida do mux estabilisar if(i<16){ // Converts and read the analog input value (value from 0.0 to 1.0) temp_codes[i] = MUXA_Read.read()*3300; }else{ - temp_codes[i] = MUXB_Read.read()*3300; + temp_codes[i] = MUXB_Read.read()*3300; } } temps_left = 32; } -*/ + + void onMsgReceived() { msgAvailable = true;