📄 debug.lst
字号:
C51 COMPILER V7.20 DEBUG 01/19/2006 13:31:03 PAGE 1
C51 COMPILER V7.20, COMPILATION OF MODULE DEBUG
OBJECT MODULE PLACED IN debug.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE debug.c BROWSE DEBUG OBJECTEXTEND
line level source
1
2 //;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 // ;;
4
5
6 #include <reg51.h>
7 #include <absacc.h>
8 #include <stdio.h>
9 #include <string.h>
10 #include "define.h"
11 #include "main.h"
12 #include "i2c.h"
13 //#include "config.h"
14 //#include "mcu.h"
15 //#include "scaler.h"
16 //#include "eeprom.h"
17 //#include "misc.h"
18 //#include "main.h"
19 //#include "ext_var.h"
20 //#include "tuner.h"
21 //#include "modeset.h"
22 //#include "isr.h"
23
24 #define bWrite 0
25 #define bRead 1
26 #define bWrite1 2
27 #define bRead1 3
28 #define bList 4
29 #define bList1 5
30 #define bRead2 6
31 #define bRead3 7
32
33
34
35 BYTE code cWrite[] = "w";
36 BYTE code cRead[] = "r";
37 BYTE code cWrite1[] = "W";
38 BYTE code cRead1[] = "R";
39 BYTE code cList[] = "l";
40 BYTE code cList1[] = "L";
41 BYTE code cRead2[] = "lr";
42 BYTE code cRead3[] = "LR";
43
44 P_CBYTE code cCmdTable[] = {cWrite, cRead, cWrite1, cRead1,cList,cList1,cRead2,cRead3};
45
46
47 static BYTE idata cRxBuf[5];
48 static BYTE cRxIndex;
49 static BYTE cArgIndex;
50 static BYTE cCommand;
51 static BYTE cDevice;
52 static BYTE cAddress;
53 static BYTE cValue;
54
55 //#define Version 002
C51 COMPILER V7.20 DEBUG 01/19/2006 13:31:03 PAGE 2
56
57 void init_debug( void ) {
58 1
59 1 cRxIndex = 0;
60 1 cArgIndex = 0;
61 1 printf( "The I2C debug program is begin!!!!\n");
62 1 }
63
64
65 BYTE atoh( BYTE ch ) {
66 1
67 1 if ( ch >= '0' && ch <= '9' ) return ( ch - '0' );
68 1 else if ( ch >= 'A' && ch <= 'F' ) return ( ch - 'A' + 10 );
69 1 else if ( ch >= 'a' && ch <= 'f' ) return ( ch - 'a' + 10 );
70 1 else return 0xff;
71 1 }
72
73
74 void kick_debug_interface() {
75 1
76 1 BYTE ch;
77 1 BYTE tempByte,i; // TestCode
78 1
79 1 if ( !RI ) return;
80 1 ch = getchar();
81 1
82 1 if ( ch != ' ' ) {
83 2 cRxBuf[cRxIndex] = ch;
84 2 if ( ++cRxIndex >= 5 ) cRxIndex = 4;
85 2 return;
86 2 }
87 1 else cRxBuf[cRxIndex] = 0x00;
88 1 cRxIndex = 0;
89 1
90 1
91 1 switch (cArgIndex++) {
92 2
93 2
94 2 // user command processing........................................
95 2
96 2 case 0:
97 2
98 2 for (ch = 0; ch < (sizeof(cCmdTable) / sizeof(P_CBYTE)); ch++)
99 2 if (!strcmp(cRxBuf, cCmdTable[ch])) break;
100 2
101 2 if (ch != sizeof(cCmdTable) / sizeof(P_CBYTE)) cCommand = ch;
102 2 else {cArgIndex = 0; printf( "Error : unknown command\n" );}
103 2 break;
104 2
105 2
106 2 // 1st command dependent parameter processing.....................
107 2
108 2 case 1:
109 2 if (cRxBuf[1]) cDevice = atoh(cRxBuf[0]) * 16 + atoh(cRxBuf[1]); // 2-digital length
110 2 else cDevice = atoh(cRxBuf[0]); // 1-digital length
111 2
112 2 if (cCommand == bList || cCommand == bList1)
113 2 {
114 3 printf("List All Regs:\n");
115 3 for(i=0;i<=0xff;i++)
116 3 {
117 4 tempByte = ReadI2CData(cDevice,i,1);
C51 COMPILER V7.20 DEBUG 01/19/2006 13:31:03 PAGE 3
118 4 printf("%x ", (WORD)tempByte);
119 4 if ((i & 0x0f) == 0x0f)
120 4 printf("\n");
121 4 if(i == 0xff)
122 4 break;
123 4 }
124 3 cArgIndex = 0;
125 3 break;
126 3 }
127 2 break;
128 2
129 2 case 2:
130 2 if (cRxBuf[1]) cAddress = atoh(cRxBuf[0]) * 16 + atoh(cRxBuf[1]); // 2-digital length
131 2 else cAddress = atoh(cRxBuf[0]); // 1-digital length
132 2
133 2 if (cCommand == bRead || cCommand == bRead1)
134 2 {
135 3 tempByte = ReadI2CData(cDevice,cAddress,1);
136 3 printf("REG%x = %x\n", (WORD)cAddress, (WORD)tempByte);
137 3
138 3 cArgIndex = 0;
139 3 break;
140 3 }
141 2 break;
142 2
143 2
144 2 // 2nd command dependent parameter processing.....................
145 2
146 2 case 3:
147 2 if (cRxBuf[1]) cValue = atoh(cRxBuf[0]) * 16 + atoh(cRxBuf[1]);
148 2 else cValue = atoh(cRxBuf[0]);
149 2
150 2 if (cCommand == bWrite || cCommand == bWrite1)
151 2 {
152 3 WriteI2CData(cDevice,cAddress,cValue);
153 3 tempByte = ReadI2CData(cDevice,cAddress,1);
154 3 printf("REG%x = %x\n", (WORD)cAddress, (WORD)tempByte);
155 3 cArgIndex = 0;
156 3 break;
157 3 }
158 2
159 2 if (cCommand == bRead2 || cCommand == bRead3)
160 2 {
161 3 printf("\n");
162 3 printf("%bd,",cValue);
163 3 printf("0x%bx,", cDevice);
164 3 printf("0x%bx,", cAddress);
165 3 for(i=0;i<cValue;i++)
166 3 {
167 4 tempByte = ReadI2CData(cDevice,cAddress,1);
168 4 if(tempByte == 0)
169 4 printf("0x00,");
170 4 else if((tempByte & 0xf0) == 0x00)
171 4 {
172 5 printf("0x0%bx,", tempByte);
173 5 }
174 4 else
175 4 {
176 5 printf("0x%bx,", tempByte);
177 5 }
178 4 if ((i & 0x0f) == 0x0f)
179 4 printf("\n");
C51 COMPILER V7.20 DEBUG 01/19/2006 13:31:03 PAGE 4
180 4 cAddress ++;
181 4 }
182 3 printf("\n");
183 3 cArgIndex = 0;
184 3 break;
185 3 }
186 2
187 2 break;
188 2
189 2 default:
190 2 printf("\n");
191 2 cArgIndex = 0;
192 2 break;
193 2 }
194 1 }
195
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 646 ----
CONSTANT SIZE = 156 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 6 3
IDATA SIZE = 5 ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -