📄 ir.lst
字号:
C51 COMPILER V7.50 IR 03/18/2008 22:29:06 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE IR
OBJECT MODULE PLACED IN ..\1out\IR.obj
COMPILER INVOKED BY: D:\设计软件\Keil\C51\BIN\C51.EXE ..\KERNEL\IR.c BROWSE INCDIR(..\INC\;..\PANEL\;..\UI\;..\OPTION\;.
-.\SCALER\DSP\) DEFINE(MCU_TYPE_SEL=0) DEBUG OBJECTEXTEND PRINT(..\1out\IR.lst) OBJECT(..\1out\IR.obj)
line level source
1 /******************************************************************************
2 Copyright (c) 2005 MStar Semiconductor, Inc.
3 All rights reserved.
4
5 [Module Name]: IR.c
6 [Date]: 01-Jun-2005
7 [Comment]:
8 Remote control recive functions.
9 [Reversion History]:
10 *******************************************************************************/
11 #define _IR_C_
12
13 /********************
14 * INCLUDE FILES *
15 *********************/
16 #include "Project.h"
17 #include "TypeDef.h"
18 #include "Global.h"
19 #include "Mcu.h"
20 #include "Mcu_reg.h"
21 #include "Misc.h"
22 #include "Debug.h"
23 #include "IR.h"
24
25 #if IR_ENABLE
26 /**********************
27 * FUNCTION PROTOTYPES *
28 ***********************/
29 #if 0
void sysIRTimer2Interrupt(void) interrupt 5
{
ET2 = 0; // disable timer2 interrupt
TR2 = 0; // stop timer2
if (!g_uwIrCycleTimer || g_bIrRepeatStatus)
g_bIrExecute = 0;
TR2 = 1; // start time12
}
////////////////////////////////////////////////////////////////////////////////////////
void sysIRInterrupt1ISR(void) interrupt 2
{
TR2 = 0; // stop timer2
g_uwIrPeriodCnt = (((WORD)TH2) * 0x100) + TL2;
TH2 = HIBYTE(IR_TIMER_COUNTER);
TL2 = LOBYTE(IR_TIMER_COUNTER);
TF2 = 0; // clear timer2 overflow flag
ET2 = 1; // enable timer2 interrupt
TR2 = 1; // start timer2
// --------------------------------------------------------------
if (g_bIrExecute == 0) // 1st tigger
C51 COMPILER V7.50 IR 03/18/2008 22:29:06 PAGE 2
{
g_bIrExecute = 1;
g_ucIrBitsCnt = 0;
g_uwIrCycleTimer = IR_CYCLE_TIME;
return;
}
// --------------------------------------------------------------
g_uwIrPeriodCnt -= IR_TIMER_COUNTER; // difference of triggers
if (g_ucIrBitsCnt == 0) // check lead header
{
// check repeat lead code
if (g_bIrRepeatStatus)
{
if (g_uwIrPeriodCnt > (IR_REPAEAT_LEAD_CNT-IR_TOLERANCE_CNT) && g_uwIrPeriodCnt < (IR_REPAEAT_LEAD_CNT+
-IR_TOLERANCE_CNT))
{
if (g_bIrCheckRepeat)
{
g_bIrRepeat = 1;
g_bIrDetect = 1;
g_uwIrTimer = IR_DELAY_TIME;
}
}
g_bIrExecute = 0;
g_uwIrCycleTimer = IR_CYCLE_TIME;
return;
}
// check genral lead code
if (g_uwIrPeriodCnt > (IR_1ST_LEAD_CNT-IR_TOLERANCE_CNT) && g_uwIrPeriodCnt < (IR_1ST_LEAD_CNT+IR_TOLERA
-NCE_CNT))
{
g_bIrError = 0;
g_bIrRepeat = 0;
g_ucDataCode = 0x00;
g_ucIrDataFifo = 0x00;
}
else // fail lead code
{
g_bIrExecute = 0;
return;
}
}
// --------------------------------------------------------------
else // receive byte code
{
// receive bit
g_ucIrDataFifo >>= 1;
if (g_uwIrPeriodCnt > (IR_LOGIC0_CNT-IR_TOLERANCE_CNT) && g_uwIrPeriodCnt < (IR_LOGIC0_CNT+IR_TOLERANCE_
-CNT))
g_ucIrDataFifo &= ~_BIT7; // logic 0
else if (g_uwIrPeriodCnt > (IR_LOGIC1_CNT-IR_TOLERANCE_CNT) && g_uwIrPeriodCnt < (IR_LOGIC1_CNT+IR_TOLE
-RANCE_CNT))
g_ucIrDataFifo |= _BIT7; // logic 1
else // mismatch
g_bIrError = 1;
// check bits counter
switch(g_ucIrBitsCnt)
{
C51 COMPILER V7.50 IR 03/18/2008 22:29:06 PAGE 3
case 8: // 1st byte
if (g_ucIrDataFifo != IR_HEADER_CODE0)
g_bIrError = 1;
break;
case 16: // 2nd byte
if (g_ucIrDataFifo != IR_HEADER_CODE1)
g_bIrError = 1;
break;
case 24: // 3rd byte
g_ucDataCode = g_ucIrDataFifo;
break;
case 32: // 4th byte
if (g_ucDataCode != ~g_ucIrDataFifo)
g_bIrError = 1;
if (!g_bIrError)
{
g_bIrRepeatStatus = 1;
g_ucIrCode = g_ucDataCode;
g_uwIrCycleTimer = IR_CYCLE_TIME;
g_bIrDetect = 1;
g_bIrCommand = 1;
g_bIrTime = 0; // IR 1st time repeat
g_bIrCheckRepeat = 0;
g_uwIrTimer = IR_DELAY_TIME;
}
g_bIrExecute = 0;
return;
} // switch
} // if (g_ucIrBitsCnt == 0)
g_ucIrBitsCnt++; // next bit
}
#endif
148
149 ////////////////////////////////////////////////////////////////////////////////////////
150 void sysIRDetectTimer0( void )
151 {
152 1 if (g_uwIrCycleTimer)
153 1 g_uwIrCycleTimer--;
154 1 else
155 1 {
156 2 g_bIrExecute = 0;
157 2 g_bIrRepeatStatus = 0;
158 2 }
159 1
160 1 //--- check IR repeat command delay time ---
161 1 if ( g_bIrCommand ) // check IR command start
162 1 {
163 2 g_uwIrTimer--;
164 2 if ( g_uwIrTimer == 0 ) // time out
165 2 {
166 3 if ( g_bIrTime ) // for 1st IR command
167 3 {
168 4 // IR 1st command executed then delay
169 4 g_bIrTime = 0; // clear 1st IR command status
170 4 g_uwIrTimer = IR_REPEAT_END_TIME;
171 4
172 4 g_bIrCheckRepeat = 1; // ready to repeat
173 4 }
174 3 else // IR repeat end or IR decode too late
C51 COMPILER V7.50 IR 03/18/2008 22:29:06 PAGE 4
175 3 {
176 4 // IR repeat command delay timer
177 4 g_bIrCommand = 0;
178 4 g_ucIrCode = 0xff;
179 4
180 4 g_bIrCheckRepeat = 0;
181 4 }
182 3 } // if time out
183 2 } // if IR command
184 1
185 1 //--- IR press 0-9 key ending timer for TUNER Channel---
186 1 /*
187 1 if ( g_bIrNumKeyStart || g_bIr100Key ) // IR key start
188 1 {
189 1 g_wIrNumKeyTimer--;
190 1 if ( g_wIrNumKeyTimer == 0 ) // time out
191 1 {
192 1 if ( _testbit_( g_bIr100Key ) )
193 1 g_ucIrNumKey = ( g_ucIrNumKey * 10 ) + 100;
194 1
195 1 g_bIrNumKeyStart = 0;
196 1 g_bIrKeyNumEnd = 1;
197 1 g_wIrNumKeyTimer = 200;
198 1 }
199 1 } // if IR key start*/
200 1 }
201
202 ////////////////////////////////////////////////////////////////////////////////////////
203 void sysIRDecodeRepaeat(WORD wRepeatTime)
204 {
205 1 if ( g_bIrRepeat ) // repeat command
206 1 {
207 2 g_bIrRepeat = 0;
208 2
209 2 g_bIrTime = 1; // start TIMER0 to repeat IR command
210 2 g_uwIrTimer = wRepeatTime; // reset repeat timer
211 2 }
212 1 else // first command before repeat
213 1 {
214 2 g_bIrTime = 1; // start TIMER0 to repeat IR command
215 2 g_uwIrTimer = IR_REPEAT_START_TIME; // set timer to check repeat
216 2 }
217 1 }
218
219 ////////////////////////////////////////////////////////////////////////////////////////
220 void sysIRDecodeEnd( void )
221 {
222 1 g_bIrCommand = 0; // end IR command
223 1
224 1 // clear repeat flag
225 1 g_bIrCheckRepeat = 0;
226 1 g_bIrRepeat = 0;
227 1
228 1 g_uwIrTimer = IR_DELAY_TIME; // any value
229 1 }
230
231 ////////////////////////////////////////////////////////////////////////////////////////
232 void sysIRInitial(void)
233 {
234 1 IR_PIN = 1;
235 1 g_bIrCommand = 0; // end IR command
236 1 g_bIrExecute = 0; // clear busy flag
C51 COMPILER V7.50 IR 03/18/2008 22:29:06 PAGE 5
237 1 g_bIrCheckRepeat = 0; // clear repeat flag
238 1 g_bIrRepeat = 0;
239 1 g_bIrDetect = 0;
240 1 g_uwIrTimer = 0;
241 1 g_uwIrCycleTimer = 0;
242 1 g_ucIrCode = 0xFF; // set IR code to 0xFF (No Key)
243 1 T2CON = 0x00;
244 1 T2MOD = 0x00;
245 1 IT1 = 1; // set INT1 level trigger
246 1 EX1 = 1; //enable MCU INT1
247 1 }
248
249 #endif // IR_ENABLE
250
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 170 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 6 ----
PDATA SIZE = ---- ----
DATA SIZE = 4 ----
IDATA SIZE = ---- ----
BIT SIZE = 8 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -