📄 ir.lst
字号:
191 6 osd_show(0x28, 1, &NULLC) ;
192 6 load_audio_volume(); printf("load_audio_volume.\n");
193 6 }
194 5 }
195 4 osd_timer=0;TR0=1;
196 4 break;
197 4 case irkey_source: // Inp_sel Button
198 4 osd_timer=0;TR0=1;
199 4 if (power_flag){
200 5 irsource_flag= 1; // IR Inp_sel Button Active
201 5 }
202 4 osd_timer=0;TR0=1;
203 4 break;
204 4 case irkey_menu: // Menu Button
205 4 osd_timer=0;TR0=1;
206 4 printf("the key is menu.\n");
207 4 if (power_flag){
208 5 irmenu_flag = 1; // IR Menu Button Active
209 5 }
210 4 osd_timer=0;TR0=1;
211 4 break;
212 4 //---------------up down left right -------------------
213 4 case irkey_up: // Menu+ Button
214 4 osd_timer=0;TR0=1;
215 4 printf("the key is up.\n");
216 4
217 4 if (power_flag){
218 5 irup_flag = 1; // IR Menu+ Button Active
219 5 }
220 4 osd_timer=0;TR0=1;
221 4 break;
222 4 case irkey_down: // Menu- Button
223 4 osd_timer=0;TR0=1;
224 4 printf("the key is down.\n");
225 4
226 4 if (power_flag){
227 5 irdown_flag = 1; // IR Menu- Button Active
228 5 }
229 4 osd_timer=0;TR0=1;
230 4 break;
231 4 case irkey_right: // Right Button
232 4 osd_timer=0;TR0=1;
233 4 printf("the key is right.\n");
234 4 if (power_flag)
235 4 {
236 5 irright_flag = 1; // IR Right Button Active
237 5 }
238 4 osd_timer=0;TR0=1;
239 4 break;
240 4 case irkey_left: // Left Button
C51 COMPILER V7.50 IR 01/14/2006 15:30:03 PAGE 5
241 4 osd_timer=0;TR0=1;
242 4 printf("the key is left.\n");
243 4 if (power_flag)
244 4 {
245 5 irleft_flag = 1; // IR Left Button Active
246 5 }
247 4 osd_timer=0;TR0=1;
248 4 break;
249 4 //----brightness + - and volume + - -----------------
250 4 case irkey_bri_add:
251 4 osd_timer=0;TR0=1;
252 4 if(power_flag){
253 5 topmenu_flag=0;
254 5 irbriadd_flag=1;
255 5 }
256 4 osd_timer=0;TR0=1;
257 4 printf("the key is bri_add.\n");
258 4 break;
259 4 case irkey_bri_sub:
260 4 osd_timer=0;TR0=1;
261 4 if(power_flag){
262 5 topmenu_flag=0;
263 5 irbrisub_flag=1;
264 5 }
265 4 osd_timer=0;TR0=1;
266 4 printf("the key is bri_sub.\n");
267 4 break;
268 4 case irkey_vol_add:
269 4 osd_timer=0;TR0=1;
270 4 if(power_flag){
271 5 topmenu_flag=0;
272 5 irvoladd_flag=1;
273 5 }
274 4 osd_timer=0;TR0=1;
275 4 printf("the key is vol_add.\n");
276 4 break;
277 4 case irkey_vol_sub:
278 4
279 4 if(power_flag){
280 5 topmenu_flag=0;
281 5 irvolsub_flag=1;
282 5 }
283 4 osd_timer=0;TR0=1;
284 4 break;
285 4 printf("the key is vol_sub.\n");
286 4 //-----------------------------------------------
287 4 default:
288 4 printf("ther key wasn't defined .\n");
289 4 break;
290 4 }
291 3 IR_data=0;
292 3 }
293 2 else{
294 3 printf("the IR_customer is error.\n");
295 3 }
296 2
297 2 ir_start_flag=0;
298 2 }
299 1 else{
300 2 EX1=1;
301 2 EA=1;
302 2 }
C51 COMPILER V7.50 IR 01/14/2006 15:30:03 PAGE 6
303 1 }
304
305
306 //**************************************************************************
307 void ir_int1(void) interrupt 2 using 1{
308 1 unsigned char i;
309 1 unsigned char data Count;
310 1 EX1 = 0;
311 1 IR_data=0;
312 1 Count=GetCycle();
313 1 if((Count>175) &&(Count<215)){
314 2 ir_start_flag=1;
315 2 } // The first press button
316 1 //else if((Count>145)&&(Count<165)){ /*ir_rep_flag=1;*/
317 1 // ir_start_flag=1;//printf("count=%bx\n",Count);
318 1 //}//repeat press some button .
319 1 else{
320 2 EX1 = 1;
321 2 return ;
322 2 } //not all
323 1 //-----------------------------------------------------------
324 1 if(ir_start_flag){ //begin to receive the ir_code .
325 2 for(i=32;i>0;i--){
326 3 Count=GetCycle(); IR_data <<= 1;
327 3 if((Count>26) && (Count<38)) IR_data ++;
328 3 else if((Count>10) && (Count<0x21)) ;
329 3 else {
330 4 EX1=1;
331 4 return;
332 4 }
333 3 }
334 2 }
335 1 IR_CODE._code=(char)IR_data; IR_data>>=8;
336 1 IR_CODE.ir_code=(char)IR_data; IR_data>>=8;
337 1 IR_CODE.customer=(int)IR_data;
338 1 ir_ok_flag=1;
339 1 }
340 //***********************************************************************
341 unsigned char GetCycle(void){
342 1 unsigned char data a=0;
343 1 while(!IR) {
344 2 Delay50us();
345 2 a++;
346 2 if(a>220){
347 3 return a;
348 3 }
349 2 }
350 1 while(IR) {
351 2 Delay50us();
352 2 a++;
353 2 if(a>220){
354 3 return a;
355 3 }
356 2 }
357 1 return(a);
358 1 }
359 //********************************************************************
360 void Delay50us(void){
361 1 unsigned char data a;
362 1 for(a=10;a>0;a--){
363 2 _nop_();
364 2 _nop_();
C51 COMPILER V7.50 IR 01/14/2006 15:30:03 PAGE 7
365 2 _nop_();
366 2 _nop_();
367 2 _nop_();
368 2 }
369 1 }
370 //*************************************************************************
371
372
373 //**********************************************************************
374
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 973 ----
CONSTANT SIZE = 435 ----
XDATA SIZE = 24 1
PDATA SIZE = ---- ----
DATA SIZE = 1 3
IDATA SIZE = ---- ----
BIT SIZE = 15 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -