report_to_aux_mcu.c 780 B

123456789101112131415161718192021222324252627282930313233
  1. #include "tasks.h"
  2. #include "usart.h"
  3. void Report_To_AuxMCU_Process(void)
  4. {
  5. static uint32_t DelayTimeCnt = 0;
  6. static uint8_t battery_delay_flag = 0;
  7. uint8_t send_buffer[4];
  8. uint8_t mode;
  9. uint16_t soc;
  10. if(battery_delay_flag == 0)
  11. {
  12. DelayTimeCnt = SysTime_5ms;
  13. battery_delay_flag = 1;
  14. }
  15. if(TimeCntDiff_5ms(DelayTimeCnt) >= 40)//40 * 5 = 200 ms
  16. {
  17. mode = 0x0C; //0x11:read£¬0x16:write£¬0x0C:report
  18. /* Battery information command word */
  19. send_buffer[0] = 0x33;
  20. send_buffer[1] = 0x02;
  21. /* Battery information data */
  22. // send_buffer[2] = (BMS_RunInfo.SOC) & 0xFF;
  23. send_buffer[2] = soc & 0xFF;
  24. send_buffer[3] = BMS_RunInfo.Status.Status;
  25. /* Send data */
  26. SendCmdData(mode, send_buffer, 4);
  27. /* Clear timing flag */
  28. battery_delay_flag = 0;
  29. }
  30. }