📄 ldd.lst
字号:
ARM COMPILER V2.32a, ldd 08/08/05 09:50:22 PAGE 1
ARM COMPILER V2.32a, COMPILATION OF MODULE ldd
OBJECT MODULE PLACED IN ldd.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe ldd.c THUMB OPTIMIZE(0,SPEED) BROWSE DEBUG TABS(4)
stmt level source
1 // LDD.c
2
3 /********************************************************************/
4 /* */
5 /* Laser Diorde Driver Control */
6 /* */
7 /********************************************************************/
8
9 #include <ADuC7020.h>
10 #include "common.h"
11
12 void delay(int i){
13 1 while (i >0)
14 1 i--;
15 1 }
16
17 void InitLdd(void){
18 1
19 1 WORD dac_final, dac_current;
20 1
21 1 dac_final = ((PAV_MSB<<8) + PAV_LSB);
22 1
23 1 for(dac_current=0; dac_current<dac_final; dac_current++){
24 2 delay(100);
25 2 DAC0DAT = (dac_current<<16);
26 2 }
27 1
28 1 SetDac(1); // Set DAC1 - ErRef
29 1
30 1 }
31
32 void SetDac(unsigned char channel){
33 1
34 1 if(channel == 0){
35 2 DAC0DAT = ((A2h[248]<<24) + (A2h[249]<<16)); // high byte + low byte
36 2 }
37 1
38 1 if(channel == 1){
39 2 DAC1DAT = ((A2h[250]<<24) + (A2h[251]<<16)); // high byte + low byte
40 2 }
41 1
42 1 dac_update = FALSE;
43 1 }
44
45
46 /********************************************************************/
47 /* */
48 /* Laser Diorde Driver ER calibration */
49 /* */
50 /********************************************************************/
51 void ErCalibration(BYTE mode){
52 1
53 1 static HALFWORD erref_low, erref_high, immon_low, immon_high, slope, offset;
54 1 static BYTE cal_low_done=0, cal_high_done=0;
55 1
56 1 switch(mode){
57 2 case 1: // store ERREF and IMMON setting data at normal temp (25degC)
58 2 erref_low = DAC1DAT>>16;
59 2 immon_low = (TXMOD_RAWDAT_MSB<<8) + TXMOD_RAWDAT_LSB;
ARM COMPILER V2.32a, ldd 08/08/05 09:50:22 PAGE 2
60 2 ER_CON=0; // clear ER_CON resister
61 2 cal_low_done=1;
62 2 break;
63 2
64 2 case 2: // store ERREF and IMMON setting data at high temp (85degC)
65 2 erref_high = DAC1DAT>>16;
66 2 immon_high = (TXMOD_RAWDAT_MSB<<8) + TXMOD_RAWDAT_LSB;
67 2 ER_CON=0; // clear ER_CON resister
68 2 cal_high_done=1;
69 2 break;
70 2
71 2 case 3: // calculate compensation slope and offset
72 2 if((cal_low_done==1) && (cal_high_done=1)){
73 3
74 3 // slope is calculated in positive integer number multiplied by 1000
75 3 slope = 1000*(erref_low - erref_high)/(immon_high - immon_low);
76 3 offset = erref_low + (slope * immon_low)/1000;
77 3
78 3 // store slope and offset
79 3 ER_SLOPE_MSB = slope>>8;
80 3 ER_SLOPE_LSB = slope&0x00FF;
81 3 ER_OFFSET_MSB = offset>>8;
82 3 ER_OFFSET_LSB = offset&0xFF;
83 3 ER_CON=0; // clear ER_CON resistser
84 3
85 3 }
86 2 break;
87 2 }
88 1 }
89
90 /********************************************************************/
91 /* */
92 /* Laser Diorde Driver ER compensation */
93 /* */
94 /********************************************************************/
95 void ErCompensation(void){
96 1
97 1 HALFWORD erref, immon, slope, offset;
98 1
99 1 immon = (TXMOD_RAWDAT_MSB<<8) + TXMOD_RAWDAT_LSB; // read Immon
100 1 slope = (ER_SLOPE_MSB<<8) + ER_SLOPE_LSB;
101 1 offset = (ER_OFFSET_MSB<<8) + ER_OFFSET_LSB;
102 1
103 1 if(offset > (slope * immon / 1000)){
104 2 erref = offset - (slope * immon / 1000); // find compensated erref
105 2 DAC1DAT = erref<<16; // update ERREF voltage
106 2
107 2 // update DAC1 monitor value at I2C resisters
108 2 ER_MSB = erref>>8;
109 2 ER_LSB = erref&0x00FF;
110 2
111 2 }
112 1 }
ARM COMPILER V2.32a, ldd 08/08/05 09:50:22 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN DATA (A2h)
EXTERN DATA (dac_update)
EXTERN CODE16 (?C?UDIV?T)
*** PUBLICS:
PUBLIC delay?T
PUBLIC SetDac?T
PUBLIC ErCalibration?T
PUBLIC ErCompensation?T
PUBLIC InitLdd?T
*** DATA SEGMENT '?DT0?ldd':
00000000 erref_low:
00000000 DS 2
00000002 erref_high:
00000002 DS 2
00000004 immon_low:
00000004 DS 2
00000006 immon_high:
00000006 DS 2
00000008 slope:
00000008 DS 2
0000000A offset:
0000000A DS 2
0000000C cal_low_done:
0000000C BEGIN_INIT
0000000C 00 DB 0x0
0000000D END_INIT
0000000D cal_high_done:
0000000D BEGIN_INIT
0000000D 00 DB 0x0
0000000E END_INIT
*** CODE SEGMENT '?PR?delay?T?ldd':
12: void delay(int i){
00000000 B401 PUSH {R0}
13: while (i >0)
00000002 E003 B L_1 ; T=0x0000000C
00000004 L_3:
00000004 A800 ADD R0,R13,#0x0
00000006 6801 LDR R1,[R0,#0x0] ; i
00000008 3901 SUB R1,#0x1
0000000A 6001 STR R1,[R0,#0x0] ; i
0000000C L_1:
0000000C A800 ADD R0,R13,#0x0
0000000E 6800 LDR R0,[R0,#0x0] ; i
00000010 2800 CMP R0,#0x0
00000012 DCF7 BGT L_3 ; T=0x00000004
15: }
00000014 B001 ADD R13,#0x4
00000016 4770 BX R14
00000018 ENDP ; 'delay?T'
*** CODE SEGMENT '?PR?InitLdd?T?ldd':
17: void InitLdd(void){
00000000 B500 PUSH {LR}
00000002 B082 SUB R13,#0x8
00000004 ; SCOPE-START
21: dac_final = ((PAV_MSB<<8) + PAV_LSB);
00000004 4800 LDR R0,=A2h + 0xF8 ; A2h+248
00000006 7800 LDRB R0,[R0,#0x0] ; A2h+248
00000008 1C01 MOV R1,R0
0000000A 0209 LSL R1,R1,#0x8
ARM COMPILER V2.32a, ldd 08/08/05 09:50:22 PAGE 4
0000000C 4800 LDR R0,=A2h + 0xF9 ; A2h+249
0000000E 7800 LDRB R0,[R0,#0x0] ; A2h+249
00000010 1809 ADD R1,R0
00000012 A800 ADD R0,R13,#0x0
00000014 6001 STR R1,[R0,#0x0] ; dac_final
23: for(dac_current=0; dac_current<dac_final; dac_current++){
00000016 2100 MOV R1,#0x0
00000018 A801 ADD R0,R13,#0x4
0000001A 6001 STR R1,[R0,#0x0] ; dac_current
0000001C E00B B L_7 ; T=0x00000036
0000001E L_8:
24: delay(100);
0000001E 2064 MOV R0,#0x64
00000020 F7FF BL delay?T ; T=0x0001 (1)
00000022 FFEE BL delay?T ; T=0x0001 (2)
25: DAC0DAT = (dac_current<<16);
00000024 A801 ADD R0,R13,#0x4
00000026 6801 LDR R1,[R0,#0x0] ; dac_current
00000028 0409 LSL R1,R1,#0x10
0000002A 4800 LDR R0,=0xFFFF0604
0000002C 6001 STR R1,[R0,#0x0]
26: }
0000002E A801 ADD R0,R13,#0x4
00000030 6801 LDR R1,[R0,#0x0] ; dac_current
00000032 3101 ADD R1,#0x1
00000034 6001 STR R1,[R0,#0x0] ; dac_current
00000036 L_7:
00000036 A800 ADD R0,R13,#0x0
00000038 6801 LDR R1,[R0,#0x0] ; dac_final
0000003A A801 ADD R0,R13,#0x4
0000003C 6800 LDR R0,[R0,#0x0] ; dac_current
0000003E 4288 CMP R0,R1
00000040 D3ED BCC L_8 ; T=0x0000001E
28: SetDac(1); // Set DAC1 - ErRef
00000042 2001 MOV R0,#0x1
00000044 F7FF BL SetDac?T ; T=0x0001 (1)
00000046 FFDC BL SetDac?T ; T=0x0001 (2)
00000048 ; SCOPE-END
30: }
00000048 B002 ADD R13,#0x8
0000004A BC08 POP {R3}
0000004C 4718 BX R3
0000004E ENDP ; 'InitLdd?T'
*** CODE SEGMENT '?PR?SetDac?T?ldd':
32: void SetDac(unsigned char channel){
00000000 B401 PUSH {R0}
34: if(channel == 0){
00000002 A800 ADD R0,R13,#0x0
00000004 7800 LDRB R0,[R0,#0x0] ; channel
00000006 2800 CMP R0,#0x0
00000008 D108 BNE L_10 ; T=0x0000001C
35: DAC0DAT = ((A2h[248]<<24) + (A2h[249]<<16)); // high byte + low byte
0000000A 4800 LDR R0,=A2h + 0xF9 ; A2h+249
0000000C 7800 LDRB R0,[R0,#0x0] ; A2h+249
0000000E 0400 LSL R0,R0,#0x10
00000010 4800 LDR R1,=A2h + 0xF8 ; A2h+248
00000012 7809 LDRB R1,[R1,#0x0] ; A2h+248
00000014 0609 LSL R1,R1,#0x18
00000016 1809 ADD R1,R0
00000018 4800 LDR R0,=0xFFFF0604
0000001A 6001 STR R1,[R0,#0x0]
36: }
0000001C L_10:
38: if(channel == 1){
0000001C A800 ADD R0,R13,#0x0
0000001E 7800 LDRB R0,[R0,#0x0] ; channel
ARM COMPILER V2.32a, ldd 08/08/05 09:50:22 PAGE 5
00000020 2801 CMP R0,#0x1
00000022 D108 BNE L_11 ; T=0x00000036
39: DAC1DAT = ((A2h[250]<<24) + (A2h[251]<<16)); // high byte + low byte
00000024 4800 LDR R0,=A2h + 0xFB ; A2h+251
00000026 7800 LDRB R0,[R0,#0x0] ; A2h+251
00000028 0400 LSL R0,R0,#0x10
0000002A 4800 LDR R1,=A2h + 0xFA ; A2h+250
0000002C 7809 LDRB R1,[R1,#0x0] ; A2h+250
0000002E 0609 LSL R1,R1,#0x18
00000030 1809 ADD R1,R0
00000032 4800 LDR R0,=0xFFFF060C
00000034 6001 STR R1,[R0,#0x0]
40: }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -