Ultima versão da banca de ensaios ECU Fev2017
Fork of Can_sniffer_BMS4 by
Diff: main.cpp
- Revision:
- 23:1a29761becd2
- Parent:
- 21:13ac27349025
- Child:
- 24:c9c7dcdcbbc5
--- a/main.cpp Sat Oct 22 18:10:23 2016 +0000 +++ b/main.cpp Sat Oct 22 19:06:09 2016 +0000 @@ -23,6 +23,16 @@ //#define BOARD1 1 // comment out this line when compiling for board #2 +//CAN devices IDs and reserved ID's +//ID|Device +//9|ECU +//11|BMS1 +//12|BMS2 +//13|BMS3 +//?|Charger + + + const unsigned int RX_ID = 0x100; const unsigned int TX_ID = 0x101; @@ -120,7 +130,7 @@ }*/ printf("\r\n"); counter++; - if(counter == 12) { + if(rxMsg.data[4] == 1) { //counter == 12 counter = 0; printf("\r\n""""""""""""""""""""""""""""""""""""""""""""""""\r\n"); @@ -130,7 +140,7 @@ if(to_send) { to_send = 0; txMsg.clear(); - txMsg.id = 10; + txMsg.id = 9; txMsg << key_switch; if(can.write(txMsg)) { printf("sent message\r\n"); @@ -139,8 +149,8 @@ count++; printf("transmission error\n\r overflow: %x\n\r", count); if(count == 3) { - count = 0; - NVIC_SystemReset(); + count = 0; + NVIC_SystemReset(); //faz reset se estiver a falhar o envio de mensagens // attach 'CAN receive-complete' interrupt handler }