📄 main.lst
字号:
C51 COMPILER V7.01 MAIN 12/22/2007 13:31:16 PAGE 1
C51 COMPILER V7.01, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE SubProgram\main.c OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\main.
-lst) OBJECT(main.obj)
stmt level source
1 //******************************************************************************************************
2 //Function :ATMEL 24xx Program REV:010
3 //Date:2007-12-5
4 //******************************************************************************************************
5 #include <REG52.H>
6 #include <stdio.h>
7 #include <absacc.h>
8 #include <intrins.h>
9 #include <math.h>
10 #include <setjmp.h>
11 #include "../SubProgram/main.h"
12 #include "../SubProgram/SubprogramList.h"
13 #include "../SubProgram/PC1602LCM.c"
14 #include "../SubProgram/menu.c"
15 #include "../SubProgram/RS232.c"
16 #include "../SubProgram/AT24Cxx.c"
17 //======================================================================================================
18 void main(void)
19 {
20 1 U32 Counts=0;
21 1
22 1 AUXR=0x03;
23 1 InitRS232();
24 1 InitialLCM();
25 1 ClearLCM();
26 1 DisplayStringData(0,StrProductInformation0,sizeof(StrProductInformation0));
27 1 DisplayStringData(1,StrProductInformation1,sizeof(StrProductInformation1)); //show manufacturer name
28 1 Delay(T1s*2);
29 1 DisplayStringData(0,StrSystemInitial0,sizeof(StrSystemInitial0));
30 1 DisplayStringData(1,StrSystemInitial1,sizeof(StrSystemInitial1)); //show system initialze..
31 1 DRAMTest();
32 1 if((Button_CS & 0x0b)==0) //up down back 3 button all short
33 1 {
34 2 Delay(T10ms);
35 2 if((Button_CS & 0x0b)!=0) //up down back 3 button all short
36 2 return;
37 2 DisplayStringData(0,StrClearHistoryDataStart0,sizeof(StrClearHistoryDataStart0));
38 2 DisplayStringData(1,StrClearHistoryDataStart1,sizeof(StrClearHistoryDataStart1));
39 2 Delay(T1s);
40 2 ClearHistoryDataMemory(); //clear History Data Memory
41 2 DisplayStringData(0,StrClearHistoryDataOK0,sizeof(StrClearHistoryDataOK0));
42 2 DisplayStringData(1,StrClearHistoryDataOK1,sizeof(StrClearHistoryDataOK1));
43 2 while(1);
44 2 }
45 1 GetSettingData(); //get user seting data
46 1 if((Button_CS & 0x03)==0) //up & down button all short
47 1 SettingProgrammer(); //check user seting
48 1 SystemInitial(); //initial all port led state
49 1 SaveSamleCode(); //read port1~port6 program code save to DRAM
50 1 DisplayStringData(0,StrSystemReadLine0,sizeof(StrSystemReadLine0));
51 1 DisplayStringData(1,StrSystemReadLine1,sizeof(StrSystemReadLine1));
52 1 while(1)
53 1 {
54 2 if((Button_CS & 0x10)==0) //reset_button short
C51 COMPILER V7.01 MAIN 12/22/2007 13:31:16 PAGE 2
55 2 {
56 3 Delay(T10ms);
57 3 if((Button_CS & 0x10)==0) //reset_button short
58 3 {
59 4 Counts=0;
60 4 SetLCMLamp(SwitchON); //LCM Lamp ON
61 4 ProgramPowerON(); //power on -->output power DC5V and DC3.3V
62 4 SystemInitial(); //initial Port LED State
63 4 ProgramPort1(); //Start Program Port 1
64 4 ProgramPort2(); //Start Program Port 2
65 4 ProgramPort3(); //Start Program Port 3
66 4 ProgramPort4(); //Start Program Port 4
67 4 ProgramPort5(); //Start Program Port 5
68 4 ProgramPort6(); //Start Program Port 6
69 4 AllProgramResult(); //show all port program result
70 4 while((Button_CS & 0x10)==0); //WAIT Start_button open
71 4 ProgramPowerOFF(); //power off-->no output
72 4 Delay(T10ms);
73 4 }
74 3 }
75 2 if(Counts<120000)
76 2 Counts++;
77 2 if(Counts==120000)
78 2 SetLCMLamp(SwitchOFF); //LCM Lamp OFF
79 2 }
80 1 }
81 //****************************************************************************************************
82 // delay 1ms*cDly = DELAY TIME max delay time=65536*0.001S=65.536S
83 //****************************************************************************************************
84 void Delay(U16 cDly)
85 {
86 1 U16 CharA=0;
87 1
88 1 while(cDly)
89 1 {
90 2 CharA=106;//212-->24MHZ 106-->12MHZ
91 2 while(CharA--);
92 2 cDly--;
93 2 }
94 1 }
95 //****************************************************************************************************
96 // DRAM TEST
97 //****************************************************************************************************
98 void DRAMTest(void)
99 {
100 1 U16 Start;
101 1 U8 CharA;
102 1
103 1 Start=0x0000;
104 1 CharA=0x80;
105 1 while(Start!=0x7fff)//7fff
106 1 {
107 2 XBYTE[Start]=CharA;
108 2 Start++;
109 2 CharA=CharA>>1;
110 2 if(CharA==0)
111 2 CharA=0x80;
112 2 }
113 1
114 1 Start=0x0000;
115 1 CharA=0x80;
116 1 while(Start!=0x7fff)
C51 COMPILER V7.01 MAIN 12/22/2007 13:31:16 PAGE 3
117 1 {
118 2 if(XBYTE[Start]!=CharA)
119 2 {
120 3 FlagError=1;
121 3 break;
122 3 }
123 2 Start++;
124 2 CharA=CharA>>1;
125 2 if(CharA==0)
126 2 CharA=0x80;
127 2 }
128 1 WaitResult();
129 1 if((FlagError!=0)||(EmpBuffer[0]!=0x20))
130 1 // if(FlagError!=0)
131 1 {
132 2 DisplayStringData(0,StrError,sizeof(StrError));
133 2 DisplayStringData(1,StrInitialError_DRAM,sizeof(StrInitialError_DRAM));
134 2 while(1);
135 2 }
136 1 }
137
138 //****************************************************************************************************
139 // Show Program RESULT
140 //****************************************************************************************************
141 void AllProgramResult(void)
142 {
143 1 U8 CharA;
144 1 U8 FlagOK=0;
145 1
146 1 for(CharA=0;CharA<24;CharA++)
147 1 {
148 2 EmpBufferA[CharA]=StrResultLine0[CharA];
149 2 }
150 1 if((FlagErrorStatus&0x7e)!=0)
151 1 {
152 2 EmpBufferA[18]='N';
153 2 EmpBufferA[19]='G';
154 2 FlagOK=1;
155 2 }
156 1 DisplayStringData(0,EmpBufferA,24);
157 1 //============================================================
158 1 for(CharA=0;CharA<24;CharA++)
159 1 {
160 2 EmpBufferA[CharA]=StrResultLine1[CharA];
161 2 }
162 1 //port1
163 1 if(FlagPort1ProgramNG==1)
164 1 {
165 2 EmpBufferA[1]='N';
166 2 EmpBufferA[2]='G';
167 2 }
168 1 else
169 1 {
170 2 if(FlagPort1State==SwitchOFF)
171 2 {
172 3 EmpBufferA[1]='N';
173 3 EmpBufferA[2]='a';
174 3 }
175 2 }
176 1 //----------------------------------------------------------------
177 1 //port2
178 1 if(FlagPort2ProgramNG==1)
C51 COMPILER V7.01 MAIN 12/22/2007 13:31:16 PAGE 4
179 1 {
180 2 EmpBufferA[5]='N';
181 2 EmpBufferA[6]='G';
182 2 }
183 1 else
184 1 {
185 2 if(FlagPort2State==SwitchOFF)
186 2 {
187 3 EmpBufferA[5]='N';
188 3 EmpBufferA[6]='a';
189 3 }
190 2 }
191 1 //-----------------------------------------------------------------
192 1 //port3
193 1 if(FlagPort3ProgramNG==1)
194 1 {
195 2 EmpBufferA[9]='N';
196 2 EmpBufferA[10]='G';
197 2 }
198 1 else
199 1 {
200 2 if(FlagPort3State==SwitchOFF)
201 2 {
202 3 EmpBufferA[9]='N';
203 3 EmpBufferA[10]='a';
204 3 }
205 2 }
206 1 //----------------------------------------------------------------
207 1 //port4
208 1 if(FlagPort4ProgramNG==1)
209 1 {
210 2 EmpBufferA[13]='N';
211 2 EmpBufferA[14]='G';
212 2 }
213 1 else
214 1 {
215 2 if(FlagPort4State==SwitchOFF)
216 2 {
217 3 EmpBufferA[13]='N';
218 3 EmpBufferA[14]='a';
219 3 }
220 2 }
221 1 //----------------------------------------------------------------
222 1 //port5
223 1 if(FlagPort5ProgramNG==1)
224 1 {
225 2 EmpBufferA[17]='N';
226 2 EmpBufferA[18]='G';
227 2 }
228 1 else
229 1 {
230 2 if(FlagPort5State==SwitchOFF)
231 2 {
232 3 EmpBufferA[17]='N';
233 3 EmpBufferA[18]='a';
234 3 }
235 2 }
236 1 //-------------------------------------------------------------
237 1 //port6
238 1 if(FlagPort6ProgramNG==1)
239 1 {
240 2 EmpBufferA[21]='N';
C51 COMPILER V7.01 MAIN 12/22/2007 13:31:16 PAGE 5
241 2 EmpBufferA[22]='G';
242 2 }
243 1 else
244 1 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -