📄 monitor.lst
字号:
263 2 }
264 1 dat = dat>>3; // delta/8;
265 1
266 1 // TxPower[W] = reference tx power[W] * (measured Impd[A] / reference Impd[A])
267 1 // measured Impd[A] = (ADCDAT * 610e-6 / 1kohm)
268 1 // reference power[W] : 1LSB = 0.1[uW], byte location A2h[122][123]
269 1 // reference Impd[A] : 1LSB = 0.1[uA], byte location A2h[124][125]
270 1 pow = (((A2h[122]<<8) + A2h[123]) * 0.1e-6 ) * (dat * 610e-6 / 1000) / (((A2h[124]<<8) + A2h[125]) *
-0.1e-6);
271 1
272 1 // TxPower[W] : 1LSB = 0.1[uW]
273 1 pow /= 0.1e-6;
274 1 pow_res = (HALFWORD)pow;
275 1
276 1 // save data
277 1 A2h[102] = (BYTE)(pow_res>>8); // write high-byte
278 1 A2h[103] = (BYTE)(pow_res & 0x00F0); // write low-byte, fix low-order 4-bit at zero
279 1 }
280
281 /********************************************************************/
282 /* */
283 /* Rx Recived Power Monitor */
284 /* */
285 /********************************************************************/
286 void rx_pow_monitor(void)
287 {
288 1 float pow;
289 1 HALFWORD pow_res;
290 1 HALFWORD i[4]; // for debug
291 1 BYTE cnt;
292 1 static HALFWORD buf[8];
293 1 static BYTE p_buf=0;
294 1 HALFWORD dat=0;
295 1
296 1 // select ADC channel
297 1 ADCCP = 0x04; // select ADC4 input channel
298 1
299 1 // start A/D conversion
300 1 for(cnt=0; cnt<4; cnt++){
301 2 ADCCON=0xA3; // software start, single-end input
302 2 while(!ADCSTA){} // wait for end of conversion
303 2 i[cnt]=(ADCDAT>>16);
304 2 }
305 1
306 1 // ADC bug fix
307 1 if(i[3] > ADC_HIGH_MAX) i[3] = 0; // limits a highest
308 1
309 1 // averaging
310 1 buf[p_buf] = i[3];
311 1 p_buf++;
312 1 p_buf &= 0x07; // reset ring-buffer pointer
313 1 for(cnt=0; cnt<8; cnt++){
314 2 dat += buf[cnt];
315 2 }
316 1 dat = dat>>3; // delta/8;
317 1
318 1 // RxPower[W] = Ipd[A] / Responsivity[A/W]
319 1 // Ipd[A] = ADCDAT * 610e-6 / 2.00Kohm
320 1 // Responsivity[A/W] : 1LSB = 0.01[A/W], byte location A2h[126]
321 1 pow = (i[3] * 610e-6 / 2e3) / (A2h[126] * 0.01);
322 1
ARM COMPILER V2.32a, monitor 08/08/05 09:50:21 PAGE 6
323 1 // RxPower[W] : 1LSB = 0.1[uW]
324 1 pow /= 0.1e-6;
325 1 pow_res = (HALFWORD)pow;
326 1
327 1 // save data
328 1 A2h[104] = (BYTE)(pow_res>>8); // write high-byte
329 1 A2h[105] = (BYTE)(pow_res & 0x00F0); // write low-byte, fix low-order 4-bit at zero
330 1 }
331
ARM COMPILER V2.32a, monitor 08/08/05 09:50:21 PAGE 7
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN DATA (A2h)
EXTERN CODE16 (?C?FCASTU?T)
EXTERN CODE16 (?C?FPMUL?T)
EXTERN CODE16 (?C?FPDIV?T)
EXTERN CODE16 (?C?CASTF?T)
*** PUBLICS:
PUBLIC temp_monitor?T
PUBLIC voltage_monitor?T
PUBLIC tx_bias_monitor?T
PUBLIC tx_mod_monitor?T
PUBLIC tx_pow_monitor?T
PUBLIC rx_pow_monitor?T
PUBLIC monitor?T
PUBLIC adc?T
*** DATA SEGMENT '?DT0?monitor':
00000000 buf:
00000000 BEGIN_INIT
00000000 0400 DW 0x400
00000002 0400 DW 0x400
00000004 0400 DW 0x400
00000006 0400 DW 0x400
00000008 0400 DW 0x400
0000000A 0400 DW 0x400
0000000C 0400 DW 0x400
0000000E 0400 DW 0x400
00000010 END_INIT
00000010 buf:
00000010 DS 16
00000020 buf:
00000020 DS 16
00000030 buf:
00000030 DS 16
00000040 buf:
00000040 DS 16
00000050 p_buf:
00000050 BEGIN_INIT
00000050 00 DB 0x0
00000051 END_INIT
00000051 p_buf:
00000051 BEGIN_INIT
00000051 00 DB 0x0
00000052 END_INIT
00000052 p_buf:
00000052 BEGIN_INIT
00000052 00 DB 0x0
00000053 END_INIT
00000053 p_buf:
00000053 BEGIN_INIT
00000053 00 DB 0x0
00000054 END_INIT
00000054 p_buf:
00000054 BEGIN_INIT
00000054 00 DB 0x0
00000055 END_INIT
*** CODE SEGMENT '?PR?monitor?T?monitor':
12: void monitor(void){
00000000 B500 PUSH {LR}
19: temp_monitor();
00000002 F7FF BL temp_monitor?T ; T=0x0001 (1)
ARM COMPILER V2.32a, monitor 08/08/05 09:50:21 PAGE 8
00000004 FFFD BL temp_monitor?T ; T=0x0001 (2)
20: voltage_monitor();
00000006 F7FF BL voltage_monitor?T ; T=0x0001 (1)
00000008 FFFB BL voltage_monitor?T ; T=0x0001 (2)
21: tx_bias_monitor();
0000000A F7FF BL tx_bias_monitor?T ; T=0x0001 (1)
0000000C FFF9 BL tx_bias_monitor?T ; T=0x0001 (2)
22: tx_mod_monitor();
0000000E F7FF BL tx_mod_monitor?T ; T=0x0001 (1)
00000010 FFF7 BL tx_mod_monitor?T ; T=0x0001 (2)
23: tx_pow_monitor();
00000012 F7FF BL tx_pow_monitor?T ; T=0x0001 (1)
00000014 FFF5 BL tx_pow_monitor?T ; T=0x0001 (2)
24: rx_pow_monitor();
00000016 F7FF BL rx_pow_monitor?T ; T=0x0001 (1)
00000018 FFF3 BL rx_pow_monitor?T ; T=0x0001 (2)
30: }
0000001A BC08 POP {R3}
0000001C 4718 BX R3
0000001E ENDP ; 'monitor?T'
*** CODE SEGMENT '?PR?adc?T?monitor':
32: HALFWORD adc(BYTE adc_ch){
00000000 B401 PUSH {R0}
00000002 B083 SUB R13,#0xC
00000004 ; SCOPE-START
37: ADCCP = adc_ch;
00000004 A803 ADD R0,R13,#0xC
00000006 7800 LDRB R0,[R0,#0x0] ; adc_ch
00000008 1C01 MOV R1,R0
0000000A 4800 LDR R0,=0xFFFF0504
0000000C 6001 STR R1,[R0,#0x0]
39: for(cnt=0; cnt<4; cnt++){
0000000E 2100 MOV R1,#0x0
00000010 A800 ADD R0,R13,#0x0
00000012 7001 STRB R1,[R0,#0x0] ; cnt
00000014 E014 B L_3 ; T=0x00000040
00000016 L_4:
40: ADCCON = 0xA3; // software start, single-end input
00000016 21A3 MOV R1,#0xA3
00000018 4800 LDR R0,=0xFFFF0500
0000001A 6001 STR R1,[R0,#0x0]
41: while(!ADCSTA){} // wait for end of conversion
0000001C L_6:
0000001C 4800 LDR R0,=0xFFFF050C
0000001E 6800 LDR R0,[R0,#0x0]
00000020 2800 CMP R0,#0x0
00000022 D0FB BEQ L_6 ; T=0x0000001C
42: adcread[cnt]=(ADCDAT>>16);
00000024 4800 LDR R0,=0xFFFF0510
00000026 6801 LDR R1,[R0,#0x0]
00000028 0C09 LSR R1,R1,#0x10
0000002A A800 ADD R0,R13,#0x0
0000002C 7800 LDRB R0,[R0,#0x0] ; cnt
0000002E 1C02 MOV R2,R0
00000030 0052 LSL R2,R2,#0x1
00000032 A801 ADD R0,R13,#0x4
00000034 1880 ADD R0,R2 ; adcread
00000036 8001 STRH R1,[R0,#0x0]
43: }
00000038 A800 ADD R0,R13,#0x0
0000003A 7801 LDRB R1,[R0,#0x0] ; cnt
0000003C 3101 ADD R1,#0x1
0000003E 7001 STRB R1,[R0,#0x0] ; cnt
00000040 L_3:
00000040 A800 ADD R0,R13,#0x0
00000042 7800 LDRB R0,[R0,#0x0] ; cnt
ARM COMPILER V2.32a, monitor 08/08/05 09:50:21 PAGE 9
00000044 2804 CMP R0,#0x4
00000046 DBE6 BLT L_4 ; T=0x00000016
46: if(adcread[3] > ADC_HIGH_MAX) adcread[3] = 0; // limits a highest
00000048 200A MOV R0,#0xA
0000004A 4468 ADD R0,R13
0000004C 8800 LDRH R0,[R0,#0x0] ; adcread+6
0000004E 4800 LDR R1,=0xFF5
00000050 4288 CMP R0,R1
00000052 D903 BLS L_10 ; T=0x0000005C
00000054 2100 MOV R1,#0x0
00000056 200A MOV R0,#0xA
00000058 4468 ADD R0,R13
0000005A 8001 STRH R1,[R0,#0x0] ; adcread+6
0000005C L_10:
48: return adcread[3];
0000005C 200A MOV R0,#0xA
0000005E 4468 ADD R0,R13
00000060 8800 LDRH R0,[R0,#0x0] ; adcread+6
00000062 ; SCOPE-END
50: }
00000062 B003 ADD R13,#0xC
00000064 B001 ADD R13,#0x4
00000066 4770 BX R14
00000068 ENDP ; 'adc?T'
*** CODE SEGMENT '?PR?temp_monitor?T?monitor':
59: void temp_monitor(void)
00000000 B500 PUSH {LR}
00000002 B086 SUB R13,#0x18
60: {
00000004 ; SCOPE-START
61: volatile HALFWORD adcread, sum=0, adcread_avr;
00000004 2100 MOV R1,#0x0
00000006 A801 ADD R0,R13,#0x4
00000008 8001 STRH R1,[R0,#0x0] ; sum
68: ADCCP = 0x10; // select internal temperature sensor
0000000A 2110 MOV R1,#0x10
0000000C 4800 LDR R0,=0xFFFF0504
0000000E 6001 STR R1,[R0,#0x0]
71: adcread = adc(0x10);
00000010 2010 MOV R0,#0x10
00000012 F7FF BL adc?T ; T=0x0001 (1)
00000014 FFF5 BL adc?T ; T=0x0001 (2)
00000016 A900 ADD R1,R13,#0x0
00000018 8008 STRH R0,[R1,#0x0] ; adcread
74: buf[p_buf] = adcread;
0000001A A800 ADD R0,R13,#0x0
0000001C 8801 LDRH R1,[R0,#0x0] ; adcread
0000001E 4800 LDR R0,=p_buf ; p_buf
00000020 7800 LDRB R0,[R0,#0x0] ; p_buf
00000022 1C02 MOV R2,R0
00000024 0052 LSL R2,R2,#0x1
00000026 4800 LDR R0,=buf ; buf
00000028 1880 ADD R0,R2 ; buf
0000002A 8001 STRH R1,[R0,#0x0]
75: p_buf++;
0000002C 4800 LDR R0,=p_buf ; p_buf
0000002E 7801 LDRB R1,[R0,#0x0] ; p_buf
00000030 3101 ADD R1,#0x1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -