📄 timer.lst
字号:
172 1 switch (TMR0_CNT)
173 1 {
174 1 case 0:
175 1 PADMOD4 = 0x10;
176 1 P6_2 = 0;
177 1 break;
178 1 case 1:
C51 COMPILER V7.50 TIMER 12/14/2006 10:36:34 PAGE 4
179 1 Key_Input = (Key_Input&0xF8) | ((P6_5&0x1)<<2)|((P6_6&0x1)<<1)|((P6_7&0x1));
180 1 PADMOD4 = 0x08;
181 1 P6_3 = 0;
182 1 break;
183 1 case 2:
184 1 Key_Input = (Key_Input&0xC7) | ((P6_5&0x1)<<5)|((P6_6&0x1)<<4)|((P6_7&0x1)<<3);
185 1 PADMOD4 = 0x04;
186 1 P6_4 = 0;
187 1 break;
188 1 case 3:
189 1 Key_Input = (Key_Input&0x3F) | ((P6_5&0x1)<<7)|((P6_6&0x1)<<6);
190 1 break;
191 1 }
192 1 */
193 1
194 1 switch (TMR0_CNT)
195 1 {
196 2 case 0:
197 2 Key_Input = (Key_Input&0x0F) | ((P6_3&0x1)<<7)|((P6_2&0x1)<<6)|((P6_1&0x1)<<5)|((P6_0&0x1)<<4);
198 2 P1_6 = 0;
199 2 P1_7 = 1;
200 2 break;
201 2 case 1:
202 2 Key_Input = (Key_Input&0xF0) | ((P6_3&0x1)<<3)|((P6_2&0x1)<<2)|((P6_1&0x1)<<1)|(P6_0&0x1);
203 2 P1_7 = 0;
204 2 P1_6 = 1;
205 2 break;
206 2 }
207 1
208 1 /*
209 1 Key_Input = ((P6_0&0x1)<<7)|((P6_1&0x1)<<6)|((P6_2&0x1)<<5)|((P6_3&0x1)<<4)|((P6_4&0x1)<<3)|
210 1 ((P6_5&0x1)<<2)|((P6_6&0x1)<<1)|(P6_7&0x1);
211 1 */
212 1
213 1 // Key_Input = ((P6_1&0x1)<<6)|((P6_2&0x1)<<5)|((P6_3&0x1)<<4)|((P6_4&0x1)<<3)|
214 1 // ((P6_5&0x1)<<2)|((P6_6&0x1)<<1)|(P6_7&0x1);
215 1
216 1 if (( TMR0_CNT&1) == 0 )
217 1 {
218 2 if (OSDTimer) OSDTimer--;
219 2
220 2 SecTimer++;
221 2 if (SecTimer >= 50 )
222 2 {
223 3 SecTimer = 0;
224 3 if (NoSigTimer)
225 3 NoSigTimer--;
226 3 if (SleepTimer)
227 3 SleepTimer--;
228 3 }
229 2
230 2 if ( Key_Input0 == Key_Input )
231 2 {
232 3 switch (Key_Input)
233 3 {
234 4 case 0xFE:
235 4 Key_Value = MENU;
236 4 Key_Pressed = 1;
237 4 break;
238 4 case 0xFD:
239 4 Key_Value = UP;
240 4 Key_Pressed = 1;
C51 COMPILER V7.50 TIMER 12/14/2006 10:36:34 PAGE 5
241 4 break;
242 4 case 0xFB:
243 4 Key_Value = DOWN;
244 4 Key_Pressed = 1;
245 4 break;
246 4 case 0xF7:
247 4 Key_Value = RIGHT;
248 4 Key_Pressed = 1;
249 4 break;
250 4 case 0xEF:
251 4 Key_Value = LEFT;
252 4 Key_Pressed = 1;
253 4 break;
254 4 case 0xDF:
255 4 Key_Value = ENTER;
256 4 Key_Pressed = 1;
257 4 break;
258 4 case 0xBF:
259 4 Key_Value = ONOFF;
260 4 Key_Pressed = 1;
261 4 break;
262 4 case 0x7F:
263 4 Key_Value = CALL;
264 4 Key_Pressed = 1;
265 4 break;
266 4 default:
267 4 Key_Value = 0xFF;
268 4 Key_Pressed = 0;
269 4 break;
270 4 }
271 3 }
272 2
273 2 if ( IR_Pressed || Key_Pressed )
274 2 {
275 3 if ( ! IR_Pressed )
276 3 Key = Key_Value;
277 3
278 3 if (KeyTimer != 0xFF ) KeyTimer++;
279 3 if (KeyTimer == 0x2 ) KeyFlag = 1;
280 3 }
281 2 else
282 2 {
283 3 Key = 0xFF;
284 3 KeyTimer = 0;
285 3 KeyFlag = 0;
286 3 }
287 2 }
288 1
289 1 TH0=0xD8; //Timer0 working in Mode 1 and set 5m sec.
290 1 TL0=0xF0; //Working Cry=24MHz 1/24M * 12 = 0.5us
291 1 //10ms = 0.5 * 10000
292 1 //TH0 = (65536 - 10000) / 256 = 0xD8
293 1 //TL0 = (65536 - 10000) % 256 = 0xF0
294 1
295 1 TF0 = 0;
296 1 TR0 = 1; //Start count Timer0
297 1 }
298
299
300 void Etimer(void) interrupt 2 using 2
301 {
302 1 IR_SND = IR_OUT;
C51 COMPILER V7.50 TIMER 12/14/2006 10:36:34 PAGE 6
303 1
304 1 if ( IR_TMR < 0xFFFF )
305 1 IR_TMR ++;
306 1
307 1 if ( IR_TMP < 4 )
308 1 {
309 2 IR_TMP++;
310 2
311 2 ETCTR &= 0x7F; // Clr TF2
312 2 // TF1 = 0;
313 2 return;
314 2 }
315 1 IR_TMP = 0;
316 1
317 1 // The Following Sub run for every 0.5625ms
318 1 if ( IR_Snd_CNT >= 191 ) // Not in Send Status
319 1 {
320 2 if ( IR_Pressed || Key_Pressed )
321 2 {
322 3 switch ( IR_SndStatus )
323 3 {
324 4 case 0:
325 4 IR_SndStatus = 1;
326 4 break;
327 4 default : // Send Code 1st time
328 4 if ( IR_SndDataCode != Key )
329 4 IR_SndStatus = 1;
330 4 else
331 4 IR_SndStatus = 2;
332 4 break;
333 4 }
334 3 IR_SndDataCode = Key;
335 3 IR_Snd_CNT = 0;
336 3 IR_SndCode_CNT = 0;
337 3 IR_SndBit_CNT = 0;
338 3 }
339 2 else
340 2 IR_SndStatus = 0;
341 2 }
342 1 else // IR Sending Status
343 1 {
344 2 switch ( IR_SndStatus )
345 2 {
346 3 case 1: // Send Code 1st time
347 3 if ( IR_Snd_CNT >= 24 && IR_Snd_CNT < 120 )
348 3 IR_Send_Code();
349 3 else if ( IR_Snd_CNT == 0 )
350 3 IR_OUT = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -