![](/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:
- 30:9c9f2d789153
- Parent:
- 29:86e963cc5ce7
- Child:
- 31:1fab4bb4e9ee
--- a/main.cpp Tue Oct 25 17:28:01 2016 +0000 +++ b/main.cpp Fri Oct 28 14:43:46 2016 +0000 @@ -169,48 +169,44 @@ for (int i=0; i<12; i++) { if(cell_codes[current_ic][i]*0.0001 > 3.6) { switch (i) { - case 0: + case 0: //cell 1 tx_cfg[0][4] = tx_cfg[0][4] | 0x01 ; // 00000001 - case 1: + case 1: //cell 2 tx_cfg[0][4] = tx_cfg[0][4] | 0x02 ; // 00000010 - case 2: + case 2: //cell 3 tx_cfg[0][4] = tx_cfg[0][4] | 0x04 ; // 00000100 - case 3: + case 3: //cell 4 tx_cfg[0][4] = tx_cfg[0][4] | 0x08 ; // 00001000 - case 4: + case 4: //cell 5 tx_cfg[0][4] = tx_cfg[0][4] | 0x10 ; // 00010000 - case 5: - tx_cfg[0][4] = tx_cfg[0][4] | 0x20 ; // 00100001 - case 6: - tx_cfg[0][4] = tx_cfg[0][4] | 0x40 ; // 01000001 - case 7: - tx_cfg[0][4] = tx_cfg[0][4] | 0x80; // 10000001 - case 8: + case 6: //cell 7 + tx_cfg[0][4] = tx_cfg[0][4] | 0x40 ; // 01000000 + case 7: //cell 8 + tx_cfg[0][4] = tx_cfg[0][4] | 0x80 ; // 10000000 + case 8: //cell 9 tx_cfg[0][5] = tx_cfg[0][5] | 0x01; // 00000001 - case 9: - tx_cfg[0][5] = tx_cfg[0][5] | 0x10; // 00000010 + case 9: //cell 10 + tx_cfg[0][5] = tx_cfg[0][5] | 0x02; // 00000010 } } else { switch (i) { - case 0: + case 0: //cell 1 tx_cfg[0][4] = tx_cfg[0][4] & 0xFE ; // 11111110 - case 1: + case 1: //cell 2 tx_cfg[0][4] = tx_cfg[0][4] & 0xFD ; // 11111101 - case 2: + case 2: //cell 3 tx_cfg[0][4] = tx_cfg[0][4] & 0xFB ; // 11111011 - case 3: + case 3: //cell 4 tx_cfg[0][4] = tx_cfg[0][4] & 0xF7 ; // 11110111 - case 4: + case 4: //cell 5 tx_cfg[0][4] = tx_cfg[0][4] & 0xEF ; // 11101111 - case 5: - tx_cfg[0][4] = tx_cfg[0][4] & 0xDF ; // 11011111 - case 6: + case 6: //cell 7 tx_cfg[0][4] = tx_cfg[0][4] & 0xBF ; // 10111111 - case 7: - tx_cfg[0][4] = tx_cfg[0][4] & 0x7F; // 01111111 - case 8: + case 7: //cell 8 + tx_cfg[0][4] = tx_cfg[0][4] & 0x7F ; // 01111111 + case 8: //cell 9 tx_cfg[0][5] = tx_cfg[0][5] & 0xFE; // 11111110 - case 9: + case 9: //cell 10 tx_cfg[0][5] = tx_cfg[0][5] & 0xFD; // 11111101 } } @@ -344,7 +340,7 @@ to_send=0; txMsg.clear(); - txMsg.id = 13; //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13. + txMsg.id = 11; //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13. txMsg.len = 5; data.f[0] = cell_codes[0][cells_left-1]*0.0001; txMsg.data[0] = data.bytes[0];