📄 timer.lst
字号:
C51 COMPILER V7.06 TIMER 11/21/2005 13:47:43 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE TIMER
OBJECT MODULE PLACED IN .\Output\Timer.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Code\Timer.c OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND CODE SYMBOLS PRINT
-(.\Output\Timer.lst) PREPRINT(.\Output\Timer.i) OBJECT(.\Output\Timer.obj)
stmt level source
1 #define __TIMER__
2
3 #include "reg52.h"
4 #include "Header\Lcd_main.h"
5 #include "Header\Lcd_auto.h"
6
7 /////////////////////////////////////////////////////////////
8 // Interrupt Service Routine for Timer0 (Fired every 20ms) //
9 /////////////////////////////////////////////////////////////
10 void IntProc_Timer0(void) interrupt 1
11 {
12 1 #if (IRPOLLING)
static unsigned char ucIR_Seq = 0xff;
static unsigned char ucTimerCnt = 0x00;
TL0 = TIME0_COUNTER_LBYTE; // Reload Timer0 low-byte
TH0 = TIME0_COUNTER_HBYTE; // Reload Timer0 high-byte
if (ucIR_State)
{
if (bIR_GPIO)
{
ucIR_Seq = (ucIR_Seq << 1) | 0x01;
if ((0xff == ucIR_Seq) && (ucIR_State & 0xfe))
{
ucIR_State = 0; // Command timeout; Back to idle state
((unsigned int *)ucIR_Cmd)[0] = 0;
}
}
else
{
if (1 < ucIR_State)
{
if (ucIR_Seq & 0x01)
{
((unsigned int *)ucIR_Cmd)[0] = (((unsigned int *)ucIR_Cmd)[0] << 1)
| (0x07 != (ucIR_Seq & 0x07) ? 1 : 0);
if (23 == ++ucIR_State && CUSTOM_CODE != ((unsigned int *)ucIR_Cmd)[0])
{
ucIR_State = 0; // Customer code error; Back to idle state
((unsigned int *)ucIR_Cmd)[0] = 0;
}
else if (39 == ucIR_State)
{
ucIR_State = 0; // Command complete; Back to idle state
ucIR_Cmd[1] = 8; // Set command timer to 8 (7*20 = 140ms)
}
}
C51 COMPILER V7.06 TIMER 11/21/2005 13:47:43 PAGE 2
else if (0x00 == (ucIR_Seq & 0xfe))
{
ucIR_State = 0; // Command crashed; Back to idle state
((unsigned int *)ucIR_Cmd)[0] = 0;
}
}
else // ucIR_State is 1
{
if (0xff == ucIR_Seq)
{
ucIR_State = 0x07; // Start to decode new command and clear old command
((unsigned int *)ucIR_Cmd)[0] = 0;
}
else
{
ucIR_State = 0; // Fire repeat command and reset to idle
ucIR_Cmd[1] = ucIR_Cmd[0] ? 8 : 0;
}
}
ucIR_Seq = ucIR_Seq << 1;
}
}
else
{
ucIR_Seq = (ucIR_Seq << 1) | bIR_GPIO;
if (0x07 == ucIR_Seq) ucIR_State = 1; // Leader code detected
}
if (54 <= ++ucTimerCnt) // 0.375ms*54 = 20.25ms passed
{
ucTimerCnt = 0;
bNotify_Timer0_Int = 1; // Post Timer0's timeout message
if (usOSD_Timer) usOSD_Timer -= 1; // For OSD Timeout
// Clear command after 144ms if not repeat code
if (0 == ucIR_State)
{
if (ucIR_Cmd[1] && 0 == --ucIR_Cmd[1]) ucIR_Cmd[0] = 0;
}
}
#else
104 1
105 1 // mega #if(MCU_TYPE == MCU_WINBOND) //anson 050519
106 1 TL0 = TIME0_COUNTER_LBYTE; // Reload Timer0 low-byte
107 1 TH0 = TIME0_COUNTER_HBYTE; // Reload Timer0 high-byte
108 1
109 1 bNotify_Timer0_Int = 1; // Post Timer0's timeout message
110 1
111 1 if (usOSD_Timer) usOSD_Timer -= 1; // For OSD Timeout
112 1 /* mega //anson 050519
113 1 #else
114 1 TL0 = TIME1_COUNTER_LBYTE; // Reload Timer1 low-byte
115 1 TH0 = TIME1_COUNTER_HBYTE; // Reload Timer1 hifh-byte
116 1 TR0 = 1; // Stop Timer1
C51 COMPILER V7.06 TIMER 11/21/2005 13:47:43 PAGE 3
117 1 bNotify_Timer1_Int = 1; // Post Timer1's timeout message
118 1
119 1 ucTimerCounter++;
120 1 if(ucTimerCounter>20)
121 1 {
122 1 ucTimerCounter=0;
123 1 bNotify_Timer0_Int = 1; // Post Timer0's timeout message
124 1 if (usOSD_Timer) usOSD_Timer -= 1; // For OSD Timeout
125 1 }
126 1 #endif
127 1 */
128 1 #endif
129 1 }
130
131 ///////////////////////////////////////////////////////////////////////
132 // Interrupt Service Routine for Timer1 (Fired in 1ms after restart) //
133 ///////////////////////////////////////////////////////////////////////
134 //mega #if(MCU_TYPE == MCU_WINBOND) //Use the standard MCU //anson 050519
135 void IntProc_Timer1(void) interrupt 3
136 {
137 1 TR1 = 0; // Stop Timer1
138 1 TL1 = TIME1_COUNTER_LBYTE; // Reload Timer1 low-byte
139 1
140 1 TH1 = (bAutoInProgress == 1) ? TIME1_COUNTER_HHBYTE : TIME1_COUNTER_HBYTE; // Reload Timer1 hifh-byte
141 1
142 1 bNotify_Timer1_Int = 1; // Post Timer1's timeout message
143 1 }
144
145 /////////////////////////////////////////////////////////////////////////////////
146 // Function Routines
147 /////////////////////////////////////////////////////////////////////////////////
148 void Delay_Xms(unsigned char x) // For delay 0 ~ 255 ms
149 {
150 1 if (x)
151 1 {
152 2 bNotify_Timer1_Int = 0; // Clear timer1's timeout message
153 2
154 2 // TL1 = TIME1_COUNTER_LBYTE; // Reload Timer1 low-byte
155 2 // TH1 = TIME1_COUNTER_HBYTE; // Reload Timer1 hifh-byte
156 2
157 2 TR1 = 1; // Start timer1
158 2
159 2 while (1)
160 2 {
161 3 if (bNotify_Timer1_Int)
162 3 {
163 4 bNotify_Timer1_Int = 0; // Clear timer1's timeout message
164 4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -