📄 remote_led.lst
字号:
259 4 if (Counter>9) Temp[i]|=0x80;
260 4 }
261 3 }
262 2 if (!(Temp[2]==~Temp[3])) { bNoise_IR=LOW;return (LOW);}
263 2 else
264 2 { UsercodeL=Temp[0];
265 3 if (Temp[0]==~Temp[1]) UsercodeH=Temp[0];
266 3 else UsercodeH=Temp[1];
267 3 Keydata=Temp[2];
268 3 }
269 2 }//end of if (!((!bInRemote_T0)&&(Counter>=40)))
270 1 if (DISP_CHIP_TYPE==PHILIP_SAA3010) {DISP_CHIP_TYPE=NEC_PD6122G; bCHIP_TYPE_STAU=HIGH;}
271 1 bNoise_IR=LOW;return (HIGH);
272 1 }
273 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
274
275 ////////////////////////////////Initial function//////////////////////////////////////////////////////////
-//
276 void Initial()
C51 COMPILER V7.06 REMOTE_LED 12/06/2004 10:42:26 PAGE 6
277 // /////////initial the output port and initial other setup///////////////////////////////////////////////
-//
278 { //////////////////////led output init///////////////////////////////////////////////////////////////
279 1 LED_OUT=0x00;
280 1 bLedCtrl_1=bLedCtrl_2=bLedCtrl_3=bLedCtrl_4=bLedCtrl_5=LOW;
281 1 //////////////////////bit var init//////////////////////////////////////////////////////////////////
282 1 bCHIP_TYPE_STAU=bDISP_DATA_TYPE=bInRemote_Flag=bDelay30s_Overflow=LOW;
283 1 bWait_LowToHigh=bInKey_Valid=bDelayFlag_PressKey=bNoise_IR=LOW;
284 1 CPU_CLK=CPU_12MHZ;DISP_CHIP_TYPE=PHILIP_SAA3010;
285 1 //CPU_CLK=CPU_24MHZ;
286 1 /////////////////////char var init//////////////////////////////////////////////////////////////////
287 1 Delay_DEC30s=0; DelayValue_PressKey=DELAY40ms;
288 1 ////////////////////////////////////////////////////////////////////////////////////////////////////
289 1 /////////////////////sfr init///////////////////////////////////////////////////////////////////////
290 1 TMOD=0x15;///T0 is counter while "bTorC_Flag=COUNT_T0" or timer while "bTorC_Flag=TIME_T0" for 100us
291 1 TL0=0xff; TH0=0xff; bTimerOrCounter_Flag=COUNT_T0;
292 1 if (CPU_CLK==CPU_12MHZ)////////////////////////////////////////////delay 1ms while T1 once overflow
293 1 {TL1=Copy_TL1=0x18; TH1=Copy_TH1=0xfc; Copy_TL0=0x9c; Copy_TH0=0x9c;}//9c////////CPU_CLK=12MHZ
294 1 else {TL1=Copy_TL1=0x30; TH1=Copy_TH1=0xf8; Copy_TL0=0x38; Copy_TH0=0x38;}//////////CPU_CLK=24MHZ
295 1 ET0=ET1=TR0=TR1=EA=HIGH;//////////////////////////////////////////////////allow interrupt for T0, T1
296 1 }
297 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
298 //////////////////////////////////Display_Led function////////////////////////////////////////////////////
-//
299 void Display_Led(uchar Disp_Data,uchar position)
300 {
301 1 switch (position)
302 1 {
303 2 case 0: bLedCtrl_2=bLedCtrl_3=bLedCtrl_4=bLedCtrl_5=LOW;bLedCtrl_1=HIGH;break;
304 2 case 1: bLedCtrl_1=bLedCtrl_3=bLedCtrl_4=bLedCtrl_5=LOW;bLedCtrl_2=HIGH;break;
305 2 case 2: bLedCtrl_1=bLedCtrl_2=bLedCtrl_4=bLedCtrl_5=LOW;bLedCtrl_3=HIGH;break;
306 2 case 3: bLedCtrl_1=bLedCtrl_2=bLedCtrl_3=bLedCtrl_5=LOW;bLedCtrl_4=HIGH;break;
307 2 case 4: bLedCtrl_1=bLedCtrl_2=bLedCtrl_3=bLedCtrl_4=LOW;bLedCtrl_5=HIGH;break;
308 2 default : break;
309 2 }
310 1 LED_OUT=Disp_Data;
311 1 }
312 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
313 /////////////////////Display_str function/////////////////////////////////////////////////////////////////
-//
314 void Display_Str()
315 { uchar i;
316 1 for (i=0;(i<5)&&((*disp_str)!=0x00);i++) { Display_Led(*disp_str,i); disp_str++;}
317 1 disp_str=disp_str-i;///////////////////////////////////////////////////////return the first position
318 1 }
319 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
320 ////////////////////////////Display_Message function//////////////////////////////////////////////////////
-//
321 void Display_Message()/////////////////////////////////////////////////////display error or noise message
322 { uint delay1s;
323 1 if (!bNoise_IR) disp_str=Disp_Error;
324 1 else disp_str=Disp_Noise;
325 1 TR0=LOW;
326 1 delay1s=Delay_DEC30s;
327 1 for (;(delay1s-Delay_DEC30s)<1000;) Display_Str();
328 1 Delay_DEC30s=DELAY30s;
329 1 TR0=HIGH;
330 1 }
331
C51 COMPILER V7.06 REMOTE_LED 12/06/2004 10:42:26 PAGE 7
332 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
333 //////////////////////////////// interrupt1 interrupt3 function///////////////////////////////////////////
-//
334 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
335 ////////////////InRemote_T0///function////////////////////////////////////////////////////////////////////
-//
336 void InRemote_T0() interrupt 1 using 1
337 { if (bTimerOrCounter_Flag==COUNT_T0)
338 1 { TR0=TR1=LOW; bInRemote_Flag=HIGH;
339 2 TMOD=0x02; TL0=Copy_TL0; TH0=Copy_TH0;Counter=0;
340 2 bTimerOrCounter_Flag=TIME_T0; TR0=HIGH;
341 2 }//the timer1 must stop while the remote signed recieve
342 1 else { Counter++;}
343 1 }
344 /////////////////InRemote_T1///function///////////////////////////////////////////////////////////////////
-//
345 void InRemote_T1() interrupt 3 using 3
346 { TL1=Copy_TL1; TH1=Copy_TH1;
347 1 if (bDelayFlag_PressKey)
348 1 { if ((--DelayValue_PressKey)==0)
349 2 { if (((!InKey_Selc_UserOrKey_Code)&&(InKey_Selc_Other))||
350 3 ((!InKey_Selc_Other)&&(InKey_Selc_UserOrKey_Code)))
351 3 bWait_LowToHigh=HIGH;
352 3 bDelayFlag_PressKey=LOW; DelayValue_PressKey=DELAY40ms;
353 3 }
354 2 }
355 1 else { if ((bWait_LowToHigh)&&(InKey_Selc_UserOrKey_Code)&&(InKey_Selc_Other))
356 2 { bWait_LowToHigh=LOW;bInKey_Valid=HIGH;}
357 2 else { if (!bInKey_Valid)
358 3 { if ((!InKey_Selc_UserOrKey_Code)&&(InKey_Selc_Other))
359 4 { Key_Data=Display_MODE; bDelayFlag_PressKey=HIGH;}
360 4 if ((InKey_Selc_UserOrKey_Code)&&(!InKey_Selc_Other))
361 4 { Key_Data=Reserv_MODE; bDelayFlag_PressKey=HIGH;}
362 4 }
363 3 }
364 2 }
365 1 if (Delay_DEC30s!=0)
366 1 { if ((--Delay_DEC30s)==0) bDelay30s_Overflow=HIGH;}
367 1 }
368 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
369 //////////////////////////////Remote_led.c//OVER//////////////////////////////////////////////////////////
-//
370 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1347 ----
CONSTANT SIZE = 45 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 21 8
IDATA SIZE = ---- ----
BIT SIZE = 10 2
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -