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.
Dependencies: CANnucleo LTC68041 mbed
Fork of BMS_2 by
Revision 35:117a807c481a, committed 2016-11-09
- Comitter:
- Crazyaboutmachines
- Date:
- Wed Nov 09 12:10:48 2016 +0000
- Parent:
- 34:8f92a17c5be9
- Child:
- 36:e70020bee11f
- Commit message:
- readed 1 ntc
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Nov 09 11:13:56 2016 +0000
+++ b/main.cpp Wed Nov 09 12:10:48 2016 +0000
@@ -16,7 +16,6 @@
CANnucleo::CAN can(PA_11, PA_12); // CAN Rx pin name, CAN Tx pin name
CANnucleo::CANMessage rxMsg;
CANnucleo::CANMessage txMsg;
-CANnucleo::CANMessage txMsg1;
DigitalOut led(PA_5);
/*!***********************************
@@ -132,11 +131,6 @@
float f[2];
} data;
-typedef union can_union2 {
- int i[2];
- char bytes[8];
- float f[2];
-} data2;
void message_trigger()
{
@@ -257,7 +251,7 @@
{
float meas;
int i=14;
- MUXA_3=1; MUXA_2=1; MUXA_1=1; MUXA_0=0; //(escolha do NTC on board)
+ MUXA_3=0; MUXA_2=0; MUXA_1=0; MUXA_0=0; //(escolha do NTC on board)
meas = MUXA_Read.read();
temp_codes[i]=meas;
temps_left = 14;
@@ -372,7 +366,6 @@
int main()
{
data data;
- data2 data2;
//printf("starting\n\r");
led =1;
wait(1);
@@ -429,7 +422,7 @@
if(to_send) {
to_send=0;
//-----------------1º send cell voltages
- txMsg.clear();
+ /* txMsg.clear();
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;
@@ -444,25 +437,28 @@
cells_left++;
//to_send=1;
}
+*/
//-----------------2º send cell temperatures
- txMsg1.clear();
- txMsg1.id = 21; //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13.
- txMsg1.len = 5;
+ txMsg.clear();
+ txMsg.id = 21; //BMS1=>ID:11; BMS2=>ID:12; BMS3=>ID:13.
+ txMsg.len = 5;
- data2.f[0] = temp_codes[temps_left-1];
+ // data.f[0] = temp_codes[temps_left-1];
+ data.f[0] = temp_codes[14];
- txMsg1.data[0] = data2.bytes[0];
- txMsg1.data[1] = data2.bytes[1];
- txMsg1.data[2] = data2.bytes[2];
- txMsg1.data[3] = data2.bytes[3];
+ txMsg.data[0] = data.bytes[0];
+ txMsg.data[1] = data.bytes[1];
+ txMsg.data[2] = data.bytes[2];
+ txMsg.data[3] = data.bytes[3];
- txMsg1.data[4] = temps_left;
+ txMsg.data[4] = temps_left;
//temps_left--;
- if(!(can.write(txMsg1))) { //se nao conseguiu transmitir continua a tentar transmitir a tensão dessa celula
+ if(!(can.write(txMsg))) { //se nao conseguiu transmitir continua a tentar transmitir a tensão dessa celula
pec_error();
//temps_left++;
//to_send=1;
}
+
}
if(msgAvailable) {
int len = can.read(rxMsg);
