?? ir_receiver.lst
字號:
C51 COMPILER V7.07 IR_RECEIVER 05/17/2006 03:13:56 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE IR_RECEIVER
OBJECT MODULE PLACED IN .\Output\IR_Receiver.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE IR_Receiver.c BROWSE DEBUG OBJECTEXTEND PRINT(.\LST\IR_Receiver.lst) OBJECT
-(.\Output\IR_Receiver.obj)
stmt level source
1 //#include <at89x52.H> // SFR definition header file
2 #include <reg54.h>
3 #include <stdio.h> // prototype declarations for I/O functions
4 #include "SystemEvent.h"
5 //#include "enum.h"
6 //#include "StructDef.h"
7 #include "Function.h"
8 #include "ExtVar.h"
9 #include <rtx51tny.h> /* RTX-51 tiny functions & defines */
10 #include "RTOS.h"
11 #include "IRKey.h"
12
13 void InitTimer2(void){
14 1 TH2 =0x00;// (unsigned char) PERIOD; // set timer period
15 1 TL2 = 0x00;//(unsigned char) PERIOD;
16 1 RCAP2H = 0xe8;
17 1 RCAP2L = 0x00;
18 1 CP_RL2=0;
19 1 C_T2=0;
20 1 TR2=1; // auto reload mode
21 1 }
22 void ResetRemoteCTRL_Use_Timer1(void);
23 void InitRemoteCTRL(void){
24 1 _RC_Data=0;
25 1 _RC_CTRL_Active=0;
26 1 ResetRemoteCTRL_Use_Timer1();
27 1 _IR_RepeatKeyDelay=_ClockX+0x80;
28 1 // InitTimer2();
29 1 }
30 #define SMOD_ 0x80
31 sbit _IRx=P3^5;
32
33 void ResetRemoteCTRL_Use_Timer1(void){
34 1 // Timer1 initial to counter mode
35 1 // It interrupt T1_INT every once a falling edge input from T1 pin tigger from remote controller
36 1 _IRx=1;
37 1 _xbit=_IRx;
38 1 // Set counter T1 mod =1;
39 1 PCON|=SMOD_;
40 1 TH1 =0xff;
41 1 TL1 = 0xff;
42 1 TMOD&=0x0f;
43 1 TMOD = TMOD | 0x60; // select mode 2
44 1 TCON&=0xf0;
45 1 // TCON|=0x05;
46 1 // enable timer 0 interrupt
47 1
48 1 TR1=1;
49 1 _RC_Word=0xffffffff;
50 1 _RC_CTRL_Reset=1;
51 1 _RC_RepeatCommand=1;
52 1
53 1 IP=0x08; // Timer1 hightest piroty
54 1
C51 COMPILER V7.07 IR_RECEIVER 05/17/2006 03:13:56 PAGE 2
55 1 ET1 = 1;
56 1 EA = 1;
57 1 }
58
59
60 void timer1 (void) interrupt 3 using 1 {
61 1 P2^=0x08;
62 1 /*
63 1 unsigned char _gx;
64 1 unsigned char _HiByte,_LowByte;
65 1 _gx=TH2;
66 1 TH2=0x00;
67 1 TL2=0x00;
68 1
69 1 // if(_Busy==1) return;
70 1
71 1 _IRTimeOut=_ClockX+5;
72 1
73 1
74 1
75 1 // _KeyTempX=0x09;//DetectButtomKey(); // pull which key press
76 1 // isr_send_signal(_HDMIFuncX);
77 1 if(_RC_CTRL_Reset){
78 1 _RC_CTRL_Reset=0;
79 1 _RC_RepeatCommand=0;
80 1 _CountOf_RC_Pulse=0x00; // because we expect next pulse been detect will be a start bit
81 1
82 1 TR1=0;
83 1
84 1 _FuncX|=_IRCommand;
85 1 isr_send_signal(_Init); // and must be skip so initial the pulse counter to 0xff
86 1 }
87 1 else {
88 1 if(_CountOf_RC_Pulse==0x00){
89 1 if(_gx==0x28){ _RC_CTRL_Reset=1;
90 1 if(_IR_RepeatKeyEnable){
91 1 _RC_RepeatCommand=1;
92 1 //_AL260FunctionModex
93 1 _FuncX|=_IRCommand;
94 1 isr_send_signal(_Init);//_AL260FuncX);
95 1 }
96 1
97 1 }
98 1 else if(_gx==0x30) _CountOf_RC_Pulse=0x20;
99 1 else _CountOf_RC_Pulse=0;
100 1 }
101 1 else {
102 1 // Since our timer_0 interval set to 0x3800 / (11059200/12) = 15.5 ms so TH0/TL0 = 0x10000-0x3800 =
- 0xc800; count up
103 1 // and the time slot between reset pulse to start bit pulse been measure is 13.68 ms
104 1 // time slot of "0" is 1.12 ms = 4.02 scale of TH0 counter
105 1 // time slot of "1" is 2.24 ms = 8.04 scale of TH0 counter
106 1 // so we select a threshold value 5 to test "0" or "1" input
107 1 _RC_Word<<=1;
108 1 if(_gx>5) _RC_Word|=0x00000001;
109 1 --_CountOf_RC_Pulse;
110 1 if(!_CountOf_RC_Pulse){ _RC_CTRL_Reset=1;
111 1 _HiByte=(unsigned char)((_RC_Word>>8)&0x00ff);
112 1 _LowByte=(unsigned char)(_RC_Word &0x00ff);
113 1 // _RC_x=_RC_Word;
114 1 if((_LowByte+_HiByte)==0xff){
115 1 // _IRTimeOut=_ClockX+10;
C51 COMPILER V7.07 IR_RECEIVER 05/17/2006 03:13:56 PAGE 3
116 1
117 1 _FuncX|=_IRCommand;
118 1 isr_send_signal(_Init);//_AL260FuncX);
119 1 _IR_RepeatKeyDelay=_ClockX+0x8;
120 1 _IR_RepeatKeyEnable=0;
121 1 }
122 1 }
123 1 else if(_gx>0x0a) _RC_CTRL_Reset=1;
124 1 }
125 1 }
126 1
127 1 */
128 1 }
129
130 /**/
131 code unsigned char _RCKeyTable[0x1e]={
132 _1x,// 0x08 // 08f7 61d6
133 _2x,// 0x88 // 8877 61d6
134 _3x,// 0x48 // 48b7 61d6
135 _4x,// 0xc8 // c837 61d6
136 _5x,// 0x28 // 28d7 61d6
137 _6x,// 0xa8 // a857 61d6
138 _7x,// 0x68 // 6897 61d6
139 _8x,// 0xe8 // 8e17 61d6
140
141 _9x,// 0x18 // 18e7 61d6
142 _0x,// 0x58 // 58a7 61d6
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -