📄 wind_routines.lst
字号:
ARM COMPILER V2.00d, wind_routines 21/10/05 22:11:30 PAGE 1
ARM COMPILER V2.00d, COMPILATION OF MODULE wind_routines
OBJECT MODULE PLACED IN .\Flash\wind_routines.obj
COMPILER INVOKED BY: C:\KEIL\ARM\BIN\CA.EXE wind_routines.c THUMB OPTIMIZE(7,SPEED) BROWSE DEBUG PRINT(.\FLASH\WIND_ROUT
-INES.LST) TABS(4) OBJECT(.\Flash\wind_routines.obj)
stmt level source
1 /******************************************************************************/
2 /* This file is part of the kp development */
3 /* Copyright kp */
4 /******************************************************************************/
5 /* */
6 /* wind routines */
7 /* */
8 /******************************************************************************/
9
10 #include <LPC213x.H> // LPC21xx definitions
11 #include <bsp.h> // include board support package
12 #include <math.h>
13
14 float wind_dir_ave;
15
16 // read wind direction bits
17 int read_wind_dir_bits() {
18 1 int x;
19 1 x = IOPIN0;
20 1 x = x >> 20;
21 1 x = x & 0x00000007;
22 1 return(x);
23 1 }
24
25 // Read wind direction
26 float wind_dir (void) {
27 1 float azmith[8] = {225.0,270.0,315.0,0.0,45.0,90.0,135.0,180.0};
28 1 float tmp;
29 1 tmp = azmith[read_wind_dir_bits()];
30 1 // calculate wind direction in degrees 0-> North, 90-> E, etc.
31 1 // read io_address and strip out the three bits.
32 1 // Average reading and calulate angle
33 1 // wind_dir_ave = ((wind_dir_ave*4) + tmp)/5;
34 1 wind_dir_ave = tmp;
35 1 return(wind_dir_ave);
36 1 }
37
38 double wind_speed (unsigned int filterred_data) {
39 1 double speed, x, X;
40 1 // Get period from interrupt routine and calculate speed.
41 1 // Interrupt routine averages the data.
42 1 // Calculate wind_speed in MPH
43 1 // Anomometer calibration equation is
44 1 // f(X) = function of freqency // curve fit equation
45 1 // (24.342758-0.008535973*X+7.410868e-7*X^2), Where X=x^0.5
46 1 double const A = 24.342758;
47 1 double const B = 0.008535973;
48 1 double const C = 7.410868e-7;
49 1 x=(double)filterred_data; // need to capture current value
50 1 // before interrupt routine modifies
51 1 X=pow(x,0.5);
52 1 speed=(A-B*X+C*X*X);
53 1 if (speed < 0.0) speed = 0.0;
54 1 if (filterred_data > 40000000) speed = 0.0;
55 1 return(speed);
56 1 }
57
58 float air_temp (void) {
ARM COMPILER V2.00d, wind_routines 21/10/05 22:11:30 PAGE 2
59 1 // This routine will read the A/D for temperature.
60 1 // The readings are avaeraged.
61 1 // The retuned value if in degrees F
62 1 return (0.0);
63 1 }
ARM COMPILER V2.00d, wind_routines 21/10/05 22:11:30 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN CODE16 (pow?T)
EXTERN CODE16 (?C?FCASTU?T)
EXTERN CODE16 (?C?FPMUL?T)
EXTERN CODE16 (?C?FPSUB?T)
EXTERN CODE16 (?C?FPADD?T)
EXTERN CODE16 (?C?FPCMP?T)
*** PUBLICS:
PUBLIC read_wind_dir_bits?T
PUBLIC wind_dir?T
PUBLIC wind_speed?T
PUBLIC air_temp?T
PUBLIC wind_dir_ave
*** DATA SEGMENT '?DT0?wind_routines':
00000000 wind_dir_ave:
00000000 DS 4
*** DATA SEGMENT '?CON?wind_routines':
00000000 ?tpl?0001:
00000000 BEGIN_INIT
00000000 43610000 DF32 225
00000004 43870000 DF32 270
00000008 439D8000 DF32 315
0000000C 00000000 DF32 0
00000010 42340000 DF32 45
00000014 42B40000 DF32 90
00000018 43070000 DF32 135
0000001C 43340000 DF32 180
00000020 END_INIT
*** CODE SEGMENT '?PR?read_wind_dir_bits?T?wind_routines':
17: int read_wind_dir_bits() {
00000000 ; SCOPE-START
19: x = IOPIN0;
00000000 4800 LDR R0,=0xE0028000
00000002 6800 LDR R0,[R0,#0x0]
00000004 ---- Variable 'x' assigned to Register 'R0' ----
20: x = x >> 20;
00000004 1500 ASR R0,R0,#0x14 ; x
21: x = x & 0x00000007;
00000006 2107 MOV R1,#0x7
00000008 4008 AND R0,R1
22: return(x);
0000000A ; SCOPE-END
23: }
0000000A 4770 BX R14
0000000C ENDP ; 'read_wind_dir_bits?T'
*** CODE SEGMENT '?PR?wind_dir?T?wind_routines':
26: float wind_dir (void) {
00000000 B500 PUSH {LR}
00000002 B088 SUB R13,#0x20
00000004 ; SCOPE-START
27: float azmith[8] = {225.0,270.0,315.0,0.0,45.0,90.0,135.0,180.0};
00000004 4800 LDR R1,=?tpl?0001 ; ?tpl?0001
00000006 A800 ADD R0,R13,#0x0
00000008 2220 MOV R2,#0x20
0000000A L_8:
0000000A 780B LDRB R3,[R1,#0x0]
0000000C 7003 STRB R3,[R0,#0x0]
0000000E 1C49 ADD R1,R1,#0x1
00000010 1C40 ADD R0,R0,#0x1
00000012 1E52 SUB R2,R2,#0x1
ARM COMPILER V2.00d, wind_routines 21/10/05 22:11:30 PAGE 4
00000014 D1F9 BNE L_8 ; T=0x0000000A
29: tmp = azmith[read_wind_dir_bits()];
00000016 F7FF BL read_wind_dir_bits?T ; T=0x0001 (1)
00000018 FFF3 BL read_wind_dir_bits?T ; T=0x0001 (2)
0000001C 0081 LSL R1,R0,#0x2 ; read_wind_dir_bits?T
0000001E A800 ADD R0,R13,#0x0
00000020 5841 LDR R1,[R0,R1]
00000022 ---- Variable 'tmp' assigned to Register 'R1' ----
34: wind_dir_ave = tmp;
00000022 4800 LDR R0,=wind_dir_ave ; wind_dir_ave
00000024 6001 STR R1,[R0,#0x0] ; tmp
35: return(wind_dir_ave);
00000026 4800 LDR R0,=wind_dir_ave ; wind_dir_ave
00000028 6800 LDR R0,[R0,#0x0] ; wind_dir_ave
0000002A ; SCOPE-END
36: }
0000002A B008 ADD R13,#0x20
0000002C BC08 POP {R3}
0000002E 4718 BX R3
00000030 ENDP ; 'wind_dir?T'
*** CODE SEGMENT '?PR?wind_speed?T?wind_routines':
38: double wind_speed (unsigned int filterred_data) {
00000000 B530 PUSH {R4-R5,LR}
00000002 1C05 MOV R5,R0 ; filterred_data
00000004 ---- Variable 'filterred_data' assigned to Register 'R5' ----
00000004 ; SCOPE-START
49: x=(double)filterred_data; // need to capture current value
00000004 1C28 MOV R0,R5 ; filterred_data
00000006 F7FF BL ?C?FCASTU?T ; T=0x0001 (1) ; ?C?FCASTU?T
00000008 FFFB BL ?C?FCASTU?T ; T=0x0001 (2) ; ?C?FCASTU?T
0000000C ---- Variable 'x' assigned to Register 'R0' ----
51: X=pow(x,0.5);
0000000C 4800 LDR R1,=0x3F000000
0000000E F7FF BL pow?T ; T=0x0001 (1)
00000010 FFF7 BL pow?T ; T=0x0001 (2)
00000014 1C03 MOV R3,R0 ; X
00000016 ---- Variable 'X' assigned to Register 'R3' ----
52: speed=(A-B*X+C*X*X);
00000016 4800 LDR R0,=0x3546EF19
00000018 1C19 MOV R1,R3 ; X
0000001A F7FF BL ?C?FPMUL?T ; T=0x0001 (1) ; ?C?FPMUL?T
0000001C FFF1 BL ?C?FPMUL?T ; T=0x0001 (2) ; ?C?FPMUL?T
00000020 1C19 MOV R1,R3 ; X
00000022 F7FF BL ?C?FPMUL?T ; T=0x0001 (1) ; ?C?FPMUL?T
00000024 FFED BL ?C?FPMUL?T ; T=0x0001 (2) ; ?C?FPMUL?T
00000028 1C02 MOV R2,R0
0000002A 4800 LDR R0,=0x3C0BDA77
0000002C 1C19 MOV R1,R3 ; X
0000002E F7FF BL ?C?FPMUL?T ; T=0x0001 (1) ; ?C?FPMUL?T
00000030 FFE7 BL ?C?FPMUL?T ; T=0x0001 (2) ; ?C?FPMUL?T
00000034 1C01 MOV R1,R0
00000036 4800 LDR R0,=0x41C2BDF8
00000038 F7FF BL ?C?FPSUB?T ; T=0x0001 (1) ; ?C?FPSUB?T
0000003A FFE2 BL ?C?FPSUB?T ; T=0x0001 (2) ; ?C?FPSUB?T
0000003E 1C11 MOV R1,R2
00000040 F7FF BL ?C?FPADD?T ; T=0x0001 (1) ; ?C?FPADD?T
00000042 FFDE BL ?C?FPADD?T ; T=0x0001 (2) ; ?C?FPADD?T
00000046 1C02 MOV R2,R0 ; speed
00000048 ---- Variable 'speed' assigned to Register 'R2' ----
53: if (speed < 0.0) speed = 0.0;
00000048 2400 MOV R4,#0x0
0000004A 1C10 MOV R0,R2 ; speed
0000004C 1C21 MOV R1,R4
0000004E F7FF BL ?C?FPCMP?T ; T=0x0001 (1) ; ?C?FPCMP?T
00000050 FFD7 BL ?C?FPCMP?T ; T=0x0001 (2) ; ?C?FPCMP?T
00000054 D2F8 BCS L_3 ; T=0x00000048
ARM COMPILER V2.00d, wind_routines 21/10/05 22:11:30 PAGE 5
00000056 2200 MOV R2,#0x0
00000058 L_3:
54: if (filterred_data > 40000000) speed = 0.0;
00000058 4800 LDR R1,=0x2625A00
0000005A 428D CMP R5,R1 ; filterred_data
0000005C D9F8 BLS L_4 ; T=0x00000050
0000005E 2200 MOV R2,#0x0
00000060 L_4:
55: return(speed);
00000060 1C10 MOV R0,R2 ; speed
00000062 ; SCOPE-END
56: }
00000062 BC30 POP {R4-R5}
00000064 BC08 POP {R3}
00000066 4718 BX R3
00000068 ENDP ; 'wind_speed?T'
*** CODE SEGMENT '?PR?air_temp?T?wind_routines':
62: return (0.0);
00000000 2000 MOV R0,#0x0
63: }
00000002 4770 BX R14
00000004 ENDP ; 'air_temp?T'
Module Information Static
----------------------------------
code size = ------
data size = 4
const size = 32
End of Module Information.
ARM COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -