📄 350_int.lst
字号:
C51 COMPILER V7.50 350_INT 12/22/2006 13:55:24 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE 350_INT
OBJECT MODULE PLACED IN 350_int.OBJ
COMPILER INVOKED BY: h:\Keil\C51\BIN\C51.EXE 350_int.c ROM(SMALL) BROWSE DEBUG OBJECTEXTEND
line level source
1 //-----------------------------------------------------------------------------
2 // 包含文件
3 //-----------------------------------------------------------------------------
4 //
5 #include "C8051F350.H"
6 #include "C8051F350_command.h"
7 #include <intrins.h>
8 //-----------------------------------------------------------------------------
9 // 外部全局变量声明区
10 //-----------------------------------------------------------------------------
11 //
12 extern unsigned char GCV_uart_send_status; //UART发送控制状态
13 extern unsigned char GCV_received_command_buf; //UART接收命令缓冲
14 extern unsigned char GCV_adc0_conver_channel_num; //ADC0转换通道号码
15 extern unsigned char GCV_conver_result_h; //ADC0转换结果高位
16 extern unsigned char GCV_conver_result_l; //ADC0转换结果低位
17
18 //-----------------------------------------------------------------------------
19 // 中断服务程序区
20 //-----------------------------------------------------------------------------
21 //准备好所有中断,以便在中断向量区生成RETI,有助抗干扰
22 //
23 //-----------------------------------------------------------------------------
24 // 外部0中断函数
25 //-----------------------------------------------------------------------------
26 //
27 void Int0_ISR(void) interrupt 0
28 {
29 1 _nop_();
30 1 _nop_();
31 1 _nop_();
32 1 }
33
34 //-----------------------------------------------------------------------------
35 // Timer0中断
36 //-----------------------------------------------------------------------------
37 //
38 void Timer0_ISR(void) interrupt 1
39 {
40 1 _nop_();
41 1 _nop_();
42 1 _nop_();
43 1 }
44 //-----------------------------------------------------------------------------
45 // 外部1中断函数
46 //-----------------------------------------------------------------------------
47 //
48 void Int1_ISR(void) interrupt 2
49 {
50 1 _nop_();
51 1 _nop_();
52 1 _nop_();
53 1 }
54 //-----------------------------------------------------------------------------
55 // Timer1中断
C51 COMPILER V7.50 350_INT 12/22/2006 13:55:24 PAGE 2
56 //-----------------------------------------------------------------------------
57 //
58 void Timer1_ISR(void) interrupt 3
59 {
60 1 _nop_();
61 1 _nop_();
62 1 _nop_();
63 1 }
64 //-----------------------------------------------------------------------------
65 // UART0中断
66 //-----------------------------------------------------------------------------
67 //
68 void UART0_ISR(void) interrupt 4
69 {
70 1 unsigned char TCV_sbuf0_mirror_image;
71 1 //发送采样数据
72 1 if(TI0)
73 1 {
74 2 TI0 = 0;
75 2 //检查还剩多少位数据未被发送出去
76 2 if( GCV_uart_send_status == 5 )
77 2 {
78 3 //发送数据起始标志1
79 3 SBUF0 = 0xda;
80 3 GCV_uart_send_status--;
81 3 }
82 2 //检查还剩多少位数据未被发送出去
83 2 else if( GCV_uart_send_status == 4 )
84 2 {
85 3 //发送数据起始标志2
86 3 SBUF0 = 0xad;
87 3 GCV_uart_send_status--;
88 3 }
89 2 //检查还剩多少位数据未被发送出去
90 2 else if( GCV_uart_send_status == 3 )
91 2 {
92 3 //发送数据通道号码
93 3 SBUF0 = GCV_adc0_conver_channel_num;
94 3 //随后改变通道的号码
95 3 GCV_adc0_conver_channel_num += 0x11;
96 3 if( GCV_adc0_conver_channel_num == 0x55 )
97 3 {
98 4 GCV_adc0_conver_channel_num = 0x11;
99 4 }
100 3 GCV_uart_send_status--;
101 3 }
102 2 //检查还剩多少位数据未被发送出去
103 2 else if( GCV_uart_send_status == 2 )
104 2 {
105 3 //发送转换结果高位
106 3 SBUF0 = GCV_conver_result_h;
107 3 GCV_uart_send_status--;
108 3 }
109 2 //检查还剩多少位数据未被发送出去
110 2 else if( GCV_uart_send_status == 1 )
111 2 {
112 3 //发送转换结果低位
113 3 SBUF0 = GCV_conver_result_l;
114 3 GCV_uart_send_status = 0;
115 3 }
116 2 else
117 2 {
C51 COMPILER V7.50 350_INT 12/22/2006 13:55:24 PAGE 3
118 3 //其他无效中断则初始化发送状态
119 3 GCV_uart_send_status = 5;
120 3 }
121 2 }
122 1 //接收上级命令
123 1 if(RI0)
124 1 {
125 2 RI0 =0;
126 2 TCV_sbuf0_mirror_image = SBUF0;
127 2 //首先满足关键字A5
128 2 if ( TCV_sbuf0_mirror_image == 0xa5 )
129 2 {
130 3 GCV_received_command_buf = 0xa5;
131 3 }
132 2 //然后满足关键字F1
133 2 else if ( ( TCV_sbuf0_mirror_image == 0xf1 ) & ( GCV_received_command_buf == 0xa5 ) )
134 2 {
135 3 GCV_received_command_buf = 0xf1;
136 3 }
137 2 //最后将命令放入命令缓冲
138 2 else if ( GCV_received_command_buf == 0xf1 )
139 2 {
140 3 GCV_received_command_buf = TCV_sbuf0_mirror_image;
141 3 }
142 2 //其他无效状态则初始化接收状态
143 2 else
144 2 {
145 3 GCV_received_command_buf = 0xff;
146 3 }
147 2 }
148 1 }
149
150 //-----------------------------------------------------------------------------
151 // ADC0中断
152 //-----------------------------------------------------------------------------
153 //
154 void ADC0_ISR(void) interrupt 10
155 {
156 1 //软件清除ADC0中断
157 1 AD0INT = 0;
158 1 //ADC0进入空闲状态,等待设置转换参数
159 1 COM_ADC0_idle;
160 1
161 1 //保存转换结果高8位
162 1 GCV_conver_result_h = ADC0H;
163 1 //保存转换结果低8位
164 1 GCV_conver_result_l = ADC0M;
165 1
166 1 //判断下次应该采样哪个通道
167 1 if( GCV_adc0_conver_channel_num == 0x11 )
168 1 {
169 2 /*
170 2 float TFV_temp_calculate_vlu;
171 2 unsigned int TIV_temp_result;*/
172 2 //上次采样为1通道,则此次采样2通道
173 2 COM_ADC0_channels_2;
174 2
175 2 /*
176 2 //计算温度显示值(差分计算)
177 2 TFV_temp_calculate_vlu = GCV_conver_result_h * 256 + GCV_conver_result_l;
178 2 TFV_temp_calculate_vlu *= 2490;
179 2 TFV_temp_calculate_vlu /= (65536 * 32);
C51 COMPILER V7.50 350_INT 12/22/2006 13:55:24 PAGE 4
180 2 TFV_temp_calculate_vlu -= 54.3;
181 2 TFV_temp_calculate_vlu /= 0.205;
182 2 TFV_temp_calculate_vlu *= 335.54;
183 2 TIV_temp_result = (unsigned int)TFV_temp_calculate_vlu;
184 2 GCV_conver_result_l = (unsigned char)TIV_temp_result;
185 2 GCV_conver_result_h = (unsigned char)(TIV_temp_result>>8); */
186 2 }
187 1 else if ( GCV_adc0_conver_channel_num == 0x22 )
188 1 {
189 2 //上次采样为2通道,则此次采样3通道
190 2 COM_ADC0_channels_3;
191 2 }
192 1 else if ( GCV_adc0_conver_channel_num == 0x33 )
193 1 {
194 2 //上次采样为3通道,则此次采样4通道
195 2 COM_ADC0_channels_4;
196 2 }
197 1 else if ( GCV_adc0_conver_channel_num == 0x44 )
198 1 {
199 2 //上次采样为4通道,则此次采样1通道
200 2 COM_ADC0_channels_1;
201 2 //COM_ADC0_channels_temp;
202 2 }
203 1 //启动下次单次转换
204 1 COM_ADC0_single_conver;
205 1 //进入信息发送状态
206 1 TI0 = 1;
207 1 //看门狗计数复位
208 1 PCA0CPH2 = 0x00;
209 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 246 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
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 + -