ZDBMS/output/Main.lst

173 lines
10 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

C51 COMPILER V9.01 MAIN 02/08/2025 15:18:20 PAGE 1
C51 COMPILER V9.01, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\output\Main.obj
COMPILER INVOKED BY: D:\Tool\Keil\C51\BIN\C51.EXE code_app\Main.c LARGE OPTIMIZE(7,SIZE) REGFILE(.\output\MCUCore_Load.O
-RC) BROWSE INTVECTOR(0X1000) INCDIR(.\header_app;.\header_drv;.\code_gasguage;.\code_classb\iec60730_lib\include;.\code_
-classb\iec60730_proc\Include;.\code_classb\config) DEBUG OBJECTEXTEND PRINT(.\output\Main.lst) OBJECT(.\output\Main.obj)
line level source
1 /********************************************************************************
2 Copyright (C), Sinowealth Electronic. Ltd.
3 Author: Sino
4 Version: V0.0
5 Date: 2020/04/26
6 History:
7 V2.0 2020/04/26 Preliminary
8 ********************************************************************************/
9 #include "Main.h"
10 #include "stdio.h"
11
12 // 发送字符串
13 char putchar(char c)
14 {
15 1 REN = 0; // 开启发送
16 1 IO_485_DE = 1; // 开启485发送
17 1 SBUF = c; // 发
18 1 while(!TI);
19 1 IO_485_DE = 0; // 关闭485发送
20 1 TI = 0;
21 1 return c;
22 1 }
23
24 /*************************************************************************************************
25 * 函数名: main
26 * 参 数: 无
27 * 返回值: 无
28 * 描 述: 主函数当初始化结束后程序会在While(1)中死循环
29 1.可通过定时器来触发各个功能模块的执行
30 2.可通过其他中断源来触发对应模块的执行
31 *************************************************************************************************/
32 void main(void)
33 {
34 1 Initial(); //初始化系统
35 1
36 1 // printf("SystemClock: 8MHz");
37 1
38 1 while(1)
39 1 {
40 2 //KeyProcess(); //按键处理
41 2
42 2 if(bTimer50msFlg) //50mS处理和AFE相关的数据采集、计算、保护等
43 2 {
44 3 McuWDTClear(); //定时清狗
45 3
46 3 bTimer50msFlg = 0;
47 3 AFEInfoProcess(); //获取AFE信息计算电压、温度、电流
48 3
49 3 BalanceProcess(); //平衡及断线处理
50 3
51 3 ProtectProcess(); //电压、电流、温度保护
52 3
53 3 PorSelfTest(); //第一次上电保护检测延时较短暂定50mS一次检测
C51 COMPILER V9.01 MAIN 02/08/2025 15:18:20 PAGE 2
54 3
55 3 LoadCheck(); //检测负载是否释放
56 3
57 3 ChgerCheck(); //检测充电器是否释放
58 3
59 3 MosCtrl(); //MOS状态检测及控制
60 3
61 3 ProtectOCRecover(); //过流保护自恢复
62 3
63 3 //LedDisplay(); //LED显示
64 3
65 3 #if (UART0_DEFINE != 0)
66 3 Uart0Check(); //检查UART0是否正常如果不正常则复位指针向量
67 3 #endif
68 3
69 3 #if (UART1_DEFINE != 0)
Uart1Check(); //检查UART1是否正常如果不正常则复位指针向量
#endif
72 3
73 3 #if (UART2_DEFINE != 0)
Uart2Check(); //检查UART2是否正常如果不正常则复位指针向量
#endif
76 3 }
77 2
78 2 if(bTimer1sFlg) //1s定时周期
79 2 {
80 3 IO_LED = ~IO_LED; //LED
81 3
82 3 // printf("\r\n");
83 3 // printf("BAT0:%.2f mV\r\n", AFE.uiCell[0]*1.0*CALIVOL/E2uiVPackGain);
84 3 // printf("BAT1:%.2f mV\r\n", AFE.uiCell[1]*1.0*CALIVOL/E2uiVPackGain);
85 3 // printf("BAT2:%.2f mV\r\n", AFE.uiCell[2]*1.0*CALIVOL/E2uiVPackGain);
86 3 // printf("BAT3:%.2f mV\r\n", AFE.uiCell[3]*1.0*CALIVOL/E2uiVPackGain);
87 3 // printf("BAT4:%.2f mV\r\n", AFE.uiCell[4]*1.0*CALIVOL/E2uiVPackGain);
88 3 // printf("TOTAL:%.2f mV\r\n",(AFE.uiCell[1]+AFE.uiCell[2]+AFE.uiCell[3]+AFE.uiCell[4])*1.0*CALIVOL/E2ui
-VPackGain);
89 3 //
90 3 // printf("\r\n");
91 3 // printf("TEMP I0:%.2f C\r\n", AFE.uiICTempe[0]*17.0/100.0-270);
92 3 // printf("TEMP I1:%.2f C\r\n", AFE.uiICTempe[1]*17.0/100.0-270);
93 3 // printf("TEMP E0:%.2f C\r\n", AFE.uiTS[0]*1.0);
94 3 // printf("TEMP E1:%.2f C\r\n", AFE.uiTS[1]*1.0);
95 3 //
96 3 // printf("\r\n");
97 3 // printf("CURR I1:%.2f mA\r\n", AFE.siCurr*1000.0*1000.0/16384/5);
98 3 // printf("\r\nBSTATUS:%x\r\n", REG.AFEBSTATUS);
99 3
100 3 bTimer1sFlg = 0;
101 3 GasGaugeManage(); //Calculate the battery charge and discharge capacity
102 3
103 3 AFERamCheck(); //检测AFE寄存器是否误写
104 3
105 3 AFETwiCheck(); //检测AFE有无连续5S通讯错误
106 3 E2PRomTwiCheck(); //检测EEPROM有无连续5S通讯错误
107 3 RTCTwiCheck(); //检测RTC有无连续5S通讯错误
108 3
109 3 if(!RamCheckProcess()) //检测参数变量区是否误写
110 3 {
111 4 SysParaInit();
112 4 }
113 3
114 3 McuFlashWrWaitCheck(); //检测是否需要更新参数到MCU Flash
C51 COMPILER V9.01 MAIN 02/08/2025 15:18:20 PAGE 3
115 3
116 3 E2PRomBKCheck(); //备份EEPROM
117 3
118 3 //LowPowerCheck(); //低功耗检测
119 3
120 3
121 3 }
122 2
123 2 SystemResetProcess(); //系统复位
124 2
125 2 ISPProcess(); //在线升级代码
126 2
127 2 CaliProcess(); //校准
128 2
129 2 McuFlashProcess(); //备份参数到MCU Flash区
130 2
131 2 E2PRomBKProcess(); //外挂EEPROM备份
132 2
133 2 //LowPowerProcess(); //低功耗处理
134 2
135 2 Info.uiPackStatus = uiPackStatus; //更新PACK和Battery的信息可通过UART反馈给主机
136 2 Info.uiBatStatus = uiBatStatus;
137 2
138 2 }
139 1 }
140
141
142
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 124 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)