📄 interrupt.lst
字号:
C51 COMPILER V8.02 INTERRUPT 08/03/2008 10:54:15 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE INTERRUPT
OBJECT MODULE PLACED IN interrupt.OBJ
COMPILER INVOKED BY: D:\Keil C51\C51\BIN\C51.EXE interrupt.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <at89x52.h>
2 #include "define.h"
3 #include "ADC.h"
4 #include "control.h"
5 #include "display.h"
6
7 extern unsigned char g_State[22]; // 各路电压输出状态 及 控制标志位g_State[0]
8 // 0x00:正常 0x01:偏高 0x02偏低 0x03:切断
9 unsigned char g_Channel; // 要手工控制的通道
10
11 void Timer_0() interrupt 1 // 自动监测中断
12 {
13 1 static unsigned char s_Channel = 1; // 进行自动监测的通道
14 1 unsigned int Result; // 读取的AD转换结果
15 1
16 1 T0_DISABLE;
17 1
18 1 if(s_Channel<9) // 前8个通道的自动监测
19 1 {
20 2 if(g_State[s_Channel]!=0x03) // 若该通道没有手工切断,进行自动监测
21 2 {
22 3 MUX1_Select(s_Channel); // 选择模拟开关通道
23 3
24 3 Result = ADC_CH2(); // 读取AD转换结果
25 3
26 3 UpdateVoltage_1(s_Channel, Result); // 更新数码管显示
27 3
28 3 if((Result>LIMIT_L) && (Result<LIMIT_H)) // 若输出电压在正常范围
29 3 {
30 4 if((g_State[s_Channel]==0x01) || (g_State[s_Channel]==0x02)) // 若之前不正常,则恢复
31 4 {
32 5 Reconnect_1(s_Channel);
33 5 ReturnFine(s_Channel);
34 5 g_State[s_Channel] = 0x00;
35 5 }
36 4 }
37 3 else
38 3 {
39 4 if(Result>LIMIT_H) // 若输出电压高于上限值
40 4 {
41 5 if(g_State[s_Channel]==0x00) // 若之前正常,则切断通道并使数码管闪烁
42 5 {
43 6 CutOff_1(s_Channel);
44 6 WrongAlarm(s_Channel);
45 6 g_State[s_Channel] = 0x01;
46 6 }
47 5 }
48 4 if(Result<LIMIT_L) // 若输出电压低于下限值
49 4 {
50 5 if(g_State[s_Channel]==0x00) // 若之前正常,则切断通道并使数码管闪烁
51 5 {
52 6 CutOff_1(s_Channel);
53 6 WrongAlarm(s_Channel);
54 6 g_State[s_Channel] = 0x02;
55 6 }
C51 COMPILER V8.02 INTERRUPT 08/03/2008 10:54:15 PAGE 2
56 5 }
57 4 }
58 3 }
59 2 }
60 1
61 1 if((s_Channel>8) && (s_Channel<17))
62 1 {
63 2 if(g_State[s_Channel]!=0x03)
64 2 {
65 3 MUX2_Select(s_Channel);
66 3
67 3 Result = ADC_CH1();
68 3
69 3 UpdateVoltage_2(s_Channel, Result);
70 3
71 3 if((Result>LIMIT_L) && (Result<LIMIT_H))
72 3 {
73 4 if((g_State[s_Channel]==0x01) || (g_State[s_Channel]==0x02))
74 4 {
75 5 Reconnect_2(s_Channel);
76 5 ReturnFine(s_Channel);
77 5 g_State[s_Channel] = 0x00;
78 5 }
79 4 }
80 3 else
81 3 {
82 4 if(Result>LIMIT_H)
83 4 {
84 5 if(g_State[s_Channel]==0x00)
85 5 {
86 6 CutOff_2(s_Channel);
87 6 WrongAlarm(s_Channel);
88 6 g_State[s_Channel] = 0x01;
89 6 }
90 5 }
91 4 if(Result<LIMIT_L)
92 4 {
93 5 if(g_State[s_Channel]==0x00)
94 5 {
95 6 CutOff_2(s_Channel);
96 6 WrongAlarm(s_Channel);
97 6 g_State[s_Channel] = 0x02;
98 6 }
99 5 }
100 4 }
101 3 }
102 2 }
103 1
104 1 if(s_Channel>16)
105 1 {
106 2 if(g_State[s_Channel]!=0x03)
107 2 {
108 3 MUX3_Select(s_Channel);
109 3
110 3 Result = ADC_CH0();
111 3
112 3 UpdateVoltage_3(s_Channel, Result);
113 3
114 3 if((Result>LIMIT_L) && (Result<LIMIT_H))
115 3 {
116 4 if((g_State[s_Channel]==0x01) || (g_State[s_Channel]==0x02))
117 4 {
C51 COMPILER V8.02 INTERRUPT 08/03/2008 10:54:15 PAGE 3
118 5 Reconnect_3(s_Channel);
119 5 ReturnFine(s_Channel);
120 5 g_State[s_Channel] = 0x00;
121 5 }
122 4 }
123 3 else
124 3 {
125 4 if(Result>LIMIT_H)
126 4 {
127 5 if(g_State[s_Channel]==0x00)
128 5 {
129 6 CutOff_3(s_Channel);
130 6 WrongAlarm(s_Channel);
131 6 g_State[s_Channel] = 0x01;
132 6 }
133 5 }
134 4 if(Result<LIMIT_L)
135 4 {
136 5 if(g_State[s_Channel]==0x00)
137 5 {
138 6 CutOff_3(s_Channel);
139 6 WrongAlarm(s_Channel);
140 6 g_State[s_Channel] = 0x02;
141 6 }
142 5 }
143 4 }
144 3 }
145 2 }
146 1
147 1 if(s_Channel==21)
148 1 {
149 2 s_Channel = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -