📄 loop.lst
字号:
C51 COMPILER V6.02 LOOP 08/02/2006 14:44:13 PAGE 1
C51 COMPILER V6.02, COMPILATION OF MODULE LOOP
OBJECT MODULE PLACED IN D:\GB_ASC\LOOP.OBJ
COMPILER INVOKED BY: e:\comp51\COMP51V6\C51.EXE D:\GB_ASC\LOOP.C DB SB OE LARGE
stmt level source
1 #include <loop.h>
2 /*****************************************************************************************************/
3 // 扫描线圈,判断线圈故障,判断有无车辆通过
4 /*****************************************************************************************************/
5 void cljc()
6 {
7 1 uchar i;
8 1
9 1 flagg=0;
10 1 for(i=0; i<32; i++) loop_set[i]=1;
11 1
12 1 cs_dram = 1;
13 1 c381 = XBYTE[0XC381]; /*读线圈状态*/
14 1 c380 = XBYTE[0XC380];
15 1 c301 = XBYTE[0XC301];
16 1 c300 = XBYTE[0XC300];
17 1 flagh = XBYTE[0XC382]; /*低四位代表线圈板标志位为1:通道为1时无故障,通道为0时故障*/
18 1 flagl = XBYTE[0XC302]; /*低四位代表线圈板标志位为0:通道为1时无车,通道为0时有车*/
19 1 flagl = flagl&0x0f;
20 1 flagh = flagh<<4;
21 1 flag = flagl|flagh;
22 1 if((flag&0x01)==0x01) /*线圈1-4的故障判别*/
23 1 {
24 2 if((c300&0x01)==0x00) loop_error[0]++; /*线圈1故障计数*/
25 2 else loop_error[0]=0;
26 2 if(loop_error[0]>5) loop_error[0]=5;
27 2 if((c300&0x02)==0x00) loop_error[1]++; /*线圈2故障计数*/
28 2 else loop_error[1]=0;
29 2 if(loop_error[1]>5) loop_error[1]=5;
30 2 if((c300&0x04)==0x00) loop_error[2]++; /*线圈3故障计数*/
31 2 else loop_error[2]=0;
32 2 if(loop_error[2]>5) loop_error[2]=5;
33 2 if((c300&0x08)==0x00) loop_error[3]++; /*线圈4故障计数*/
34 2 else loop_error[3]=0;
35 2 if(loop_error[3]>5) loop_error[3]=5;
36 2 }
37 1 if((flag&0x02)==0x02) /*线圈5-8的故障判别*/
38 1 {
39 2 if((c300&0x10)==0x00)loop_error[4]++; /*线圈5故障计数*/
40 2 else loop_error[4]=0;
41 2 if(loop_error[4]>5)loop_error[4]=5;
42 2 if((c300&0x20)==0x00)loop_error[5]++; /*线圈6故障计数*/
43 2 else loop_error[5]=0;
44 2 if(loop_error[5]>5)loop_error[5]=5;
45 2 if((c300&0x40)==0x00)loop_error[6]++; /*线圈7故障计数*/
46 2 else loop_error[6]=0;
47 2 if(loop_error[6]>5)loop_error[6]=5;
48 2 if((c300&0x80)==0x00)loop_error[7]++; /*线圈8故障计数*/
49 2 else loop_error[7]=0;
50 2 if(loop_error[7]>5)loop_error[7]=5;
51 2 }
52 1 if((flag&0x04)==0x04) /*线圈9-12的故障判别*/
53 1 {
54 2 if((c301&0x01)==0x00)loop_error[8]++; /*线圈9故障计数*/
55 2 else loop_error[8]=0;
C51 COMPILER V6.02 LOOP 08/02/2006 14:44:13 PAGE 2
56 2 if(loop_error[8]>5)loop_error[8]=5;
57 2 if((c301&0x02)==0x00)loop_error[9]++; /*线圈10故障计数*/
58 2 else loop_error[9]=0;
59 2 if(loop_error[9]>5)loop_error[9]=5;
60 2 if((c301&0x04)==0x00)loop_error[10]++; /*线圈11故障计数*/
61 2 else loop_error[10]=0;
62 2 if(loop_error[10]>5)loop_error[10]=5;
63 2 if((c301&0x08)==0x00)loop_error[11]++; /*线圈12故障计数*/
64 2 else loop_error[11]=0;
65 2 if(loop_error[11]>5)loop_error[11]=5;
66 2 }
67 1 if((flag&0x08)==0x08) /*线圈13-16的故障判别*/
68 1 {
69 2 if((c301&0x10)==0x00)loop_error[12]++; /*线圈13故障计数*/
70 2 else loop_error[12]=0;
71 2 if(loop_error[12]>5)loop_error[12]=5;
72 2 if((c301&0x20)==0x00)loop_error[13]++; /*线圈14故障计数*/
73 2 else loop_error[13]=0;
74 2 if(loop_error[13]>5)loop_error[13]=5;
75 2 if((c301&0x40)==0x00)loop_error[14]++; /*线圈15故障计数*/
76 2 else loop_error[14]=0;
77 2 if(loop_error[14]>5)loop_error[14]=5;
78 2 if((c301&0x80)==0x00)loop_error[15]++; /*线圈16故障计数*/
79 2 else loop_error[15]=0;
80 2 if(loop_error[15]>5)loop_error[15]=5;
81 2 }
82 1 if((flag&0x10)==0x10) /*线圈17-20的故障判别*/
83 1 {
84 2 if((c380&0x01)==0x00)loop_error[16]++; /*线圈17故障计数*/
85 2 else loop_error[16]=0;
86 2 if(loop_error[16]>5)loop_error[16]=5;
87 2 if((c380&0x02)==0x00)loop_error[17]++; /*线圈18故障计数*/
88 2 else loop_error[17]=0;
89 2 if(loop_error[17]>5)loop_error[17]=5;
90 2 if((c380&0x04)==0x00)loop_error[18]++; /*线圈19故障计数*/
91 2 else loop_error[18]=0;
92 2 if(loop_error[18]>5)loop_error[18]=5;
93 2 if((c380&0x08)==0x00)loop_error[19]++; /*线圈20故障计数*/
94 2 else loop_error[19]=0;
95 2 if(loop_error[19]>5)loop_error[19]=5;
96 2 }
97 1 if((flag&0x20)==0x20) /*线圈20-24的故障判别*/
98 1 {
99 2 if((c380&0x10)==0x00)loop_error[20]++; /*线圈21故障计数*/
100 2 else loop_error[20]=0;
101 2 if(loop_error[20]>5)loop_error[20]=5;
102 2 if((c380&0x20)==0x00)loop_error[21]++; /*线圈22故障计数*/
103 2 else loop_error[21]=0;
104 2 if(loop_error[21]>5)loop_error[21]=5;
105 2 if((c380&0x40)==0x00)loop_error[22]++; /*线圈23故障计数*/
106 2 else loop_error[22]=0;
107 2 if(loop_error[22]>5)loop_error[22]=5;
108 2 if((c380&0x80)==0x00)loop_error[23]++; /*线圈24故障计数*/
109 2 else loop_error[23]=0;
110 2 if(loop_error[23]>5)loop_error[23]=5;
111 2 }
112 1 if((flag&0x40)==0x40) /*线圈24-28的故障判别*/
113 1 {
114 2 if((c381&0x01)==0x00)loop_error[24]++; /*线圈25故障计数*/
115 2 else loop_error[24]=0;
116 2 if(loop_error[24]>5)loop_error[24]=5;
117 2 if((c381&0x02)==0x00)loop_error[25]++; /*线圈26故障计数*/
C51 COMPILER V6.02 LOOP 08/02/2006 14:44:13 PAGE 3
118 2 else loop_error[25]=0;
119 2 if(loop_error[25]>5)loop_error[25]=5;
120 2 if((c381&0x04)==0x00)loop_error[26]++; /*线圈27故障计数*/
121 2 else loop_error[26]=0;
122 2 if(loop_error[26]>5)loop_error[26]=5;
123 2 if((c381&0x08)==0x00)loop_error[27]++; /*线圈28故障计数*/
124 2 else loop_error[27]=0;
125 2 if(loop_error[27]>5)loop_error[27]=5;
126 2 }
127 1 if((flag&0x80)==0x80) /*线圈28-32的故障判别*/
128 1 {
129 2 if((c381&0x10)==0x00)loop_error[28]++; /*线圈29故障计数*/
130 2 else loop_error[28]=0;
131 2 if(loop_error[28]>5)loop_error[28]=5;
132 2 if((c381&0x20)==0x00)loop_error[29]++; /*线圈30故障计数*/
133 2 else loop_error[29]=0;
134 2 if(loop_error[29]>5)loop_error[29]=5;
135 2 if((c381&0x40)==0x00)loop_error[30]++; /*线圈31故障计数*/
136 2 else loop_error[30]=0;
137 2 if(loop_error[30]>5)loop_error[30]=5;
138 2 if((c381&0x80)==0x00)loop_error[31]++; /*线圈32故障计数*/
139 2 else loop_error[31]=0;
140 2 if(loop_error[31]>5)loop_error[31]=5;
141 2 }
142 1 lpp=0;
143 1 for(i=0;i<16;i++)
144 1 {
145 2 ttemp=0x0001;
146 2 if(loop_error[i]==5)
147 2 {
148 3 ttemp=(ttemp<<i);
149 3 lpp=(lpp|ttemp); //lpp中位内容为1代表该线圈代表该线圈故障1-16
150 3 }
151 2 }
152 1 hpp=0;
153 1 for(i=0;i<16;i++)
154 1 {
155 2 ttemp=0x0001;
156 2 if(loop_error[i+16]==5)
157 2 {
158 3 ttemp=(ttemp<<i);
159 3 hpp=(hpp|ttemp); //hpp中位内容为1代表该线圈代表该线圈故障17-32
160 3 }
161 2 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -