You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

359 lines
12 KiB

C51 COMPILER V9.54 ASP_LOWPOWER 09/06/2024 11:24:45 PAGE 1
C51 COMPILER V9.54, COMPILATION OF MODULE ASP_LOWPOWER
OBJECT MODULE PLACED IN ..\out\asp_lowpower.obj
COMPILER INVOKED BY: E:\KeilC51\C51\BIN\C51.EXE ..\source\asp\asp_lowpower.c LARGE OMF2 OPTIMIZE(0,SIZE) BROWSE ORDER NO
-INTPROMOTE INCDIR(..\source\bsp;..\source\msp;..\source\app;..\source\clib;..\source\cpu;..\source\ctask;..\source\tpc;.
-.\source\asp;..\source\debug;..\source\msp\uart;..\source\msp\simiic;..\source\bsp\oled;..\source\bsp\TTSSbsp) DEBUG PRI
-NT(..\out\asp_lowpower.lst) TABS(2) OBJECT(..\out\asp_lowpower.obj)
line level source
1 //////////////////////////////////////////////////////////////////////////
2 /// COPYRIGHT NOTICE
3 /// Copyright (c) 2023, 传控科技
4 /// All rights reserved.
5 ///
6 /// @file asp_gsensor.c
7 /// @brief asp_gsensor
8 ///
9 ///(本文件实现的功能的详述)
10 ///
11
12 ////20221217_213321 CCmodify new uart struct for road protocol
13
14 #include "msp_uart1.h"
*** WARNING C320 IN LINE 51 OF ..\source\bsp\TTSSbsp\bsp_config.h: "MainFre_22M"
15
16 #include "msp_UART2.h"
17
18 #include "debug_drv.h"
19 #include "bsp_config.h"
20 #include "asp_gsensor.h"
21 #include "bsp_moto.h"
22
23 #include "asp_move.h"
24
25 #include "asp_lowpower.h"
26
27 #define D_version_main "7.0"
28
29
30
31 void L0_uart_close(void)
32 {
33 1 L0_uart1_str("\r\nuart1 close");///
34 1 Lc_delay_ms(20);
35 1
36 1 EA = 0;
37 1 D_uart1_ES_INT(0);
38 1 //// D_UART2_ES_INT(0);
39 1 AUXR = 0; //定时器2开始计时
40 1
41 1 ET1 = 0; //禁止定时器%d中断
42 1 TR1 = 0; //定时器1开始计时
43 1 }
44 void L0_uart1_open(void)
45 {//
46 1 L0_uart1_buf_init();//串口初始化//
47 1
48 1 EA = 1;
49 1 L0_uart1_str("\r\nuart1 open");
50 1 }
51 void L0_uart2_open(void)
C51 COMPILER V9.54 ASP_LOWPOWER 09/06/2024 11:24:45 PAGE 2
52 {//
53 1 // L0_uart2_buf_init();
54 1
55 1 EA = 1;
56 1 L0_uart1_str("\r\nuart2 open");
57 1 }
58
59
60
61 void L0_SetWakeUpTime(u16 SetTime)
62 {
63 1 SetTime = (U16)((32768UL * (U32)SetTime) / 16000); //重装值 = Fwkt/16 * SetTime/1000 = Fwkt * SetT
-ime / 16000
64 1 if(SetTime > 0) SetTime--;
65 1 WKTCL = (u8)SetTime;
66 1 WKTCH = (u8)(SetTime >> 8) | 0x80;
67 1 }
68
69
70 void L0_main_lowp_set(void)
71 {//
72 1 L0_uart_close();
73 1 L0_SetWakeUpTime(10000);///
74 1 BITN_1(P_SW2 ,BITN7);///P_SW2|=0x80;
75 1 ////PCON = 0;
76 1
77 1
78 1 ///0:禁止端口内部的 4.1K 上拉电阻
79 1 ///1:使能端口内部的 4.1K 上拉电阻
80 1 P0PU = 0;
81 1 P1PU = 0;
82 1 P2PU = 0;
83 1 P3PU = 0;
84 1 P4PU = 0;
85 1 P5PU = 0;
86 1
87 1
88 1 ///0:使能端口的施密特触发功能。(上电复位后默认使能施密特触发)
89 1 P0NCS = 0xff;
90 1 P1NCS = 0xff;
91 1 P2NCS = 0xff;
92 1 P3NCS = 0xff;
93 1 P4NCS = 0xff;
94 1 P5NCS = 0xff;
95 1
96 1
97 1
98 1
99 1
100 1 ////1:电平转换速度慢,相应的上下冲比较小
101 1 P0SR =0xff;
102 1 P1SR =0xff;
103 1 P2SR =0xff;
104 1 P3SR =0xff;
105 1 P4SR =0xff;
106 1 P5SR =0xff;
107 1
108 1 ///1:一般驱动能力
109 1 P0DR =0xff;
110 1 P1DR =0xff;
111 1 P2DR =0xff;
112 1 P3DR =0xff;
C51 COMPILER V9.54 ASP_LOWPOWER 09/06/2024 11:24:45 PAGE 3
113 1 P4DR =0xff;
114 1 P5DR =0xff;
115 1
116 1 ///0:禁止数字信号输入。若 I/O 被当作比较器输入口、ADC 输入口、触摸按键输入
-口或者为外部晶 振接入脚等模拟口时,
117 1 ///进入时钟停振模式前,必须设置为 0,否则会有额外的耗电。
118 1 ///1:使能数字信号输入。若 I/O 被当作数字口时,必须设置为 1,否 MCU 无法读取
-外部端口的电平。
119 1 P0IE =0;
120 1 P1IE =0;
121 1 P2IE =0;
122 1 P3IE =0;
123 1 P4IE =0;
124 1 P5IE =0;
125 1
126 1 BITN_1(P_SW2 ,BITN7);USBCON = 0;
127 1 ////USBCON = 0;
128 1 ///USBCON = 0x80;
129 1
130 1 ADC_CONTR = 0; ////建议进入空闲模式和掉电模式前将 ADC 电源关闭,以降低功耗
131 1 RSTCFG = 0;//没有变化43ua 41ua 低压复位控制位
132 1
133 1 D_HighR_P0_ALL();
134 1 D_HighR_P1_ALL();
135 1 D_HighR_P2_ALL();
136 1 D_HighR_P3_ALL();
137 1 D_HighR_P4_ALL();
138 1 D_HighR_P5_ALL();/***********
139 1
140 1 P3 = 0;
141 1
142 1
143 1 P0 = 0;
144 1 P1 = 0;
145 1 P2 = 0;
146 1 P4 = 0;
147 1 P5 = 0;
148 1
149 1
150 1 *********/
151 1
152 1 P0 = 0xff;
153 1 P1 = 0xff;
154 1 P2 = 0xff;
155 1 P4 = 0xff;
156 1 P5 = 0xff;
157 1
158 1 D_stdIO_P4(BITN1);
159 1 ///D_OpenD_P4(BITN1);
160 1 D_P41_ON();
161 1
162 1
163 1 /*****
164 1
165 1 // XOSCCR =0;
166 1 ///HIRCCR = 0;
167 1 IRC32KCR = 0x80; //启动内部32K IRC
168 1 while (!(IRC32KCR & 1)); //等待时钟稳定
169 1 CLKDIV = 0x00; //时钟不分频
170 1 CLKSEL = 0x03; //选择内部32K
171 1 P_SW2 = 0x00;
172 1
C51 COMPILER V9.54 ASP_LOWPOWER 09/06/2024 11:24:45 PAGE 4
173 1 P45
174 1 P27
175 1 P26
176 1 P44
177 1 P43
178 1 p13
179 1 P23 switch2 限位开关
180 1 P40 SWITCH1 限位开关
181 1
182 1 P41 SW_CAL 电源分压电阻 =1 关闭
183 1 *******/
184 1
185 1 }
186
187 /*
188
189 void L2_main_version(u8 d)
190 {
191
192 printfs(D_version_main);
193 L1_uartD_uc(d);
194 printfs(D_BOARD_NAME);
195 printfs(__DATE__);
196 printfs(__TIME__);
197
198
199 }
200 */
201
202
203 void L1_main_lowp_test(void)
204 {//
205 1
206 1 while(9)
207 1 {
208 2 /// L2_gsensor_init(0);
209 2 L0_main_lowp_set();
210 2 _nop_();
211 2 _nop_();
212 2
213 2 //// L0_uart_close();
214 2
215 2 PCON = 0x02; ////2222 //MCU进入掉电模式
216 2 ///D_LPCD_INT_CLOSE(); 对掉电唤醒后有一个中断进来没有效果
217 2 _nop_();
218 2 _nop_(); _nop_();
219 2 _nop_(); _nop_();
220 2 _nop_();
221 2
222 2 L0_uart1_open();
223 2 L0_uart2_open();
224 2 /// L2_main_version(0);
225 2
226 2 /// L2_gsensor_init(1);
227 2 }
228 1
229 1 }
230
231
232 void L3_test_lp(u8 filter)//// ON listen function
233 {
234 1 if(filter == pd->filter)
C51 COMPILER V9.54 ASP_LOWPOWER 09/06/2024 11:24:45 PAGE 5
235 1 {///filter num d1 d2 d3 ....dn
236 2 //// FD 08 11 22 33 44 55 66 77 88
237 2 ///printf("\r\nDdebug:F1 R1 R2 R3 R4 ocr FD->");
238 2 switch (pd->ocr)
239 2 {
240 3 case 0x22: ///'s'
241 3 ///FX R1 R2 R3 R4 ocr
242 3 ///F1 m R2 R3 R4 22
243 3
244 3 // L0_moto_run(pd->R1);
245 3 printf1("22: moto=(%X)",(int)pd->R1);
246 3 break;
247 3
248 3 default:
249 3 printfs(" pp error\r\n ");
250 3
251 3 break;
252 3 };
253 2
254 2 printfs("333");
255 2 }
256 1 }
257 /***
258
259 case 0x23: ///'s'
260 ///FX R1 R2 R3 R4 ocr
261 ///F1 m R2 R3 R4 22
262 if(pd->R1)
263 {
264 D_BUZ_OPEN();
265
266 }else
267 {
268 D_BUZ_OFF();
269
270 }
271 printf("22: moto=(%X)",(int)pd->R1);
272 break;
273
274
275 case 0x24: ///'s'
276 ///F1 m 23 56 64 22
277 ts_task_move.loc_angle[0] = pd->R1;
278 ts_task_move.loc_angle[1] = pd->R2;
279 ts_task_move.loc_angle[2] = pd->R3;
280 ts_task_move.loc_angle[3] = pd->R4;
281 L3_task_s_go(ts_task_move,D_task_move_init);
282 printf("move: %d %d %d %d )",(int)pd->R1,(int)pd->R2,(int)pd->R3,(int)pd->R4);
283 break;
284 case 0x25: ///'s'
285 ///F1 m 23 56 64 22
286 ts_task_move.loc_angle[0] = pd->R1;
287 ts_task_move.loc_angle[1] = pd->R2;
288 ts_task_move.loc_angle[2] = pd->R3;
289 ts_task_move.loc_angle[3] = pd->R4;
290 L3_task_s_go(ts_task_move,D_task_move_init);
291 ts_task_move.loc_now =D_2uc_u16(pd->R1, pd->R2);
292 printf("move: loc_now %XH %d )",(int)ts_task_move.loc_now,(int)ts_task_move.loc_now);
293 break;
294
295 case 0x26: ///'s'
296 ///F1 m 23 56 64 22
C51 COMPILER V9.54 ASP_LOWPOWER 09/06/2024 11:24:45 PAGE 6
297 ts_task_move.loc_angle[0] = pd->R1;
298 if(pd->R1)
299 {
300 ts_task_move.loc_now ++;
301 }
302 else
303 {
304 ts_task_move.loc_now --;
305 }
306 printf("move: loc_now %XH %d ->%d )",(int)ts_task_move.loc_now,(int)ts_task_move.loc_now,(int)ts_task_
-move.loc_want);
307 break;
308
309
310
311
312 ****/
313
314
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 590 ----
CONSTANT SIZE = 71 ----
XDATA SIZE = 3 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)