📄 main.lst
字号:
139: {
140: Status=S1;
141: Stop_Timer1();
142: Start_Timer1();
143:
144: }//jump next status:S1
145:
146:
147: break;
148: case S1:
149:
150: PMC(V0);VP(5);Arith_AD();
151: if(bShortCurrent)
152: {
153: Status=Soff;
154: break;
155: }
156: if(Time10ms<=100)
157: {
158: if(!VP_I)
159: {
160: Status=S1;
161: }//VP_I=0;VP_U=0;PMC_I=0;PMC_U=0;
162:
163: else
164: {
165: Status=S2;
166: Stop_Timer1();
167: }
168: }
169: else
170: {
171: Stop_Timer1();
172: Status=S0_0;
173: }
174:
175:
176: break;
177: case S2:
178: PMC(V0);VP(Z);Arith_AD();
179: if(bShortCurrent)
180: {
181: Status=Soff;
182: break;
183: }
184:
185: if(!PMC_I && !VP_U)
186: {Status=S3;}
187:
188: else
189: {Status=S7;}
190:
191:
192: break;
193: case S3:
194: PMC(Z);VP(5);Arith_AD();
195: if(bShortCurrent)
196: {
197: Status=Soff;
198: break;
199: }
200:
201: if(50<=PMC_U && PMC_U<270)//0.25V<=PMC:U<1.35V
202: {Status=S4;}
203: else if(PMC_U<50)
204: {Status=S7;}
205: else if(PMC_U>=270)
206: {Status=S5;}
207: break;
208: case S4:
209: PMC(Z);VP(10);Arith_AD();//VP(10);
210: if(bShortCurrent)
211: {
212: Status=Soff;
213: break;
214: }
215: if(PMC_U<270)
216: {Status=S7;}
217: else if(PMC_U>=270)
218: {Status=S6;}
219: break;
220: case S5:
221: PMC(V0);VP(5);Arith_AD();
222: if(bShortCurrent)
223: {
224: Status=Soff;
225: break;
226: }
227: if(VP_I || PMC_U>10)
228: {Status=S5;}
229: else
230: {Status=S0_0;}
231: break;
232: case S6:
233: PMC(V0);VP(10);Arith_AD();//VP(10);
234: if(bShortCurrent)
235: {
236: Status=Soff;
237: break;
238: }
239: if(VP_I || PMC_U>10)
240: {Status=S6;}
241: else
242: {Status=S0_0;}
243: break;
244: case S7:
245: PMC(V0);VP(Z);Arith_AD();//VP(5) FOR ATV31 DEVICE
246: if(bShortCurrent)
247: {
248: Status=Soff;
249: break;
250: }
251: if(!PMC_I && !VP_U)
252: {Status=S0_0;}
253: else
254: {Status=S7;}
255: break;
256:
257: default:
258: {PMC(Z);VP(Z);
259: // RA4=1;bSC_first=1;bShortCurrent=0;
260: // n=20000;
261: // while(n--){;}//delay 20000*2us=40ms before sampling adc
262: // Status=S1;RA4=0; //test delay time of short current
263: }
264: //Soff: stop usb cable when short current occurs external device
265:
266: }
267:
268:
269: // Arith_AD(); //sample adc
270:
271: }
272: }
273:
274:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -