?? interrupt.lst
字號:
C51 COMPILER V7.20 INTERRUPT 07/12/2006 09:11:37 PAGE 1
C51 COMPILER V7.20, COMPILATION OF MODULE INTERRUPT
OBJECT MODULE PLACED IN .\obj\interrupt.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE USER\interrupt.c LARGE OPTIMIZE(9,SIZE) BROWSE NOAREGS DEFINE(K_CARD_TYPE=0
-x01,K_CARD_TOTAL=0x01) DEBUG OBJECTEXTEND PRINT(.\lst\interrupt.lst) OBJECT(.\obj\interrupt.obj)
line level source
1 //===========================================================
2 // Project Name(項目名稱): SPCA755 rebuild
3 // File Name(模塊名稱): interrupt.c
4 // Built Date(創(chuàng)建日期):2004-09-14
5 // Abstract(模塊描述): 中斷功能函數模塊
6 // Revision History(版本信息):
7 // Rev Date Author Comment(修改說明)
8 // 1.0 2004-09-14 XYQ created
9 //================================================================================================
10 #include "..\userdefine.h"
11 #include "interrupt.h"
12 #include "userinit.h"
13 #include "user.h"
14 #include "main.h"
15 //================================================================================================
16 data U8 gc_KeyValue=0;
17 data U8 gc_BatteryValue=0xff;
18 data U8 gc_ADCOldKey=0;
19 data U8 gc_LongKeyDelay=0;
20 data U8 gc_LongKeyTimer=0;
21 data U8 gc_QuarterTimer=0;
22 data U8 gc_BlinkTimer;
23 data U8 gc_SysSecondTimer;
24 //================================================================================================
25 data U8 gc_SecondTimer;
26 data U8 gc_minuteTimer;
27 data U8 gc_basetimerx4;//lyh add
28 //================================================================================================
29 #define K_USE_SPCA759_KEYB
30
31 //================================================================================================
32 void UserExtInterrupt() interrupt 0 using 1
33 {
34 1
35 1 INTR_Int0();
36 1
37 1 }
38
39 void User_Timer() interrupt 1 using 2
40 {//每7.8ms會進行中斷一次(into this intterrupt per 7.8ms)
41 1 //該函數用戶不能刪除,否則定時器會不準確
42 1
43 1
44 1 TIMER0_Routine();//the function must call here(該函數在此必須調用,該函數為設置定時器初值)
45 1
46 1 gc_QuarterTimer = (gc_QuarterTimer >= 3)?0:gc_QuarterTimer+1;
47 1
48 1 switch(gc_QuarterTimer)
49 1 {
50 2 case 0:
51 2 if (gc_SysSecondTimer)
52 2 {
53 3 gc_SysSecondTimer--;
54 3 }else{
C51 COMPILER V7.20 INTERRUPT 07/12/2006 09:11:37 PAGE 2
55 3 gc_SysSecondTimer = SECONDTIMER_VALUE;
56 3 }
57 2 break;
58 2 case 1:
59 2
60 2 gc_BatteryValue = USER_READSAR(2); //read SAR output
61 2
62 2 if (USB_PlugDetect())
63 2 {
64 3 gc_BatteryValue = 0xff;
65 3 }
66 2
67 2 if (gc_BlinkTimer)gc_BlinkTimer--;
68 2
69 2 if (gc_LongKeyTimer) gc_LongKeyTimer++;
70 2 break;
71 2 case 2:
72 2 if (!gc_KeyValue)
73 2 {//if oldevent haven't been deal with, not to get new keyValue
74 3
75 3 if (1)
76 3 {
77 4 data U8 tc_ADCCurrentKey;
78 4
79 4 tc_ADCCurrentKey = USER_READSAR(0); //read SAR output
80 4
81 4 #if 0
#ifdef K_USE_SPCA759_KEYB
if (tc_ADCCurrentKey>240) tc_ADCCurrentKey=0;
else if(tc_ADCCurrentKey>171) tc_ADCCurrentKey=1;
else if(tc_ADCCurrentKey>149) tc_ADCCurrentKey=2;
else if(tc_ADCCurrentKey>124) tc_ADCCurrentKey=3;
else if(tc_ADCCurrentKey>96) tc_ADCCurrentKey=4;
else if(tc_ADCCurrentKey>66) tc_ADCCurrentKey=5;
else if(tc_ADCCurrentKey>36) tc_ADCCurrentKey=6;
else if(tc_ADCCurrentKey>11) tc_ADCCurrentKey=7;
else tc_ADCCurrentKey = 8;
/* if (tc_ADCCurrentKey>240) tc_ADCCurrentKey=0;
else if(tc_ADCCurrentKey>217) tc_ADCCurrentKey=1;
else if(tc_ADCCurrentKey>182) tc_ADCCurrentKey=2;
else if(tc_ADCCurrentKey>139) tc_ADCCurrentKey=3;
else if(tc_ADCCurrentKey>104) tc_ADCCurrentKey=4;
else if(tc_ADCCurrentKey>75) tc_ADCCurrentKey=5;
else if(tc_ADCCurrentKey>41) tc_ADCCurrentKey=6;
else if(tc_ADCCurrentKey>14) tc_ADCCurrentKey=7;
else tc_ADCCurrentKey = 8;*/
#else
if (tc_ADCCurrentKey>240) tc_ADCCurrentKey=0;
else if(tc_ADCCurrentKey>220) tc_ADCCurrentKey=1;
else if(tc_ADCCurrentKey>202) tc_ADCCurrentKey=2;
else if(tc_ADCCurrentKey>181) tc_ADCCurrentKey=3;
else if(tc_ADCCurrentKey>147) tc_ADCCurrentKey=4;
else if(tc_ADCCurrentKey>105) tc_ADCCurrentKey=5;
else if(tc_ADCCurrentKey>61) tc_ADCCurrentKey=6;
else if(tc_ADCCurrentKey>20) tc_ADCCurrentKey=7;
else tc_ADCCurrentKey = 8;
#endif
#else//MoonBox key value V2.0
113 4
114 4 if (tc_ADCCurrentKey>240) tc_ADCCurrentKey=0;
115 4 else if(tc_ADCCurrentKey>217) tc_ADCCurrentKey=7;
116 4 else if(tc_ADCCurrentKey>182) tc_ADCCurrentKey=8;
C51 COMPILER V7.20 INTERRUPT 07/12/2006 09:11:37 PAGE 3
117 4 else if(tc_ADCCurrentKey>139) tc_ADCCurrentKey=5;
118 4 else if(tc_ADCCurrentKey>104) tc_ADCCurrentKey=4; //VOL+
119 4 else if(tc_ADCCurrentKey>75) tc_ADCCurrentKey=6; //MODE
120 4 else if(tc_ADCCurrentKey>41) tc_ADCCurrentKey=2; //LAST
121 4 else if(tc_ADCCurrentKey>14) tc_ADCCurrentKey=1; //NEXT
122 4 else tc_ADCCurrentKey = 3; //PLAY
123 4 /*
124 4 if (tc_ADCCurrentKey>240) tc_ADCCurrentKey=0;
125 4 else if(tc_ADCCurrentKey>210) tc_ADCCurrentKey=1;
126 4 else if(tc_ADCCurrentKey>180) tc_ADCCurrentKey=2;
127 4 else if(tc_ADCCurrentKey>140) tc_ADCCurrentKey=3;
128 4 else if(tc_ADCCurrentKey>96) tc_ADCCurrentKey=4;
129 4 else if(tc_ADCCurrentKey>66) tc_ADCCurrentKey=5;
130 4 else if(tc_ADCCurrentKey>36) tc_ADCCurrentKey=6;
131 4 else if(tc_ADCCurrentKey>11) tc_ADCCurrentKey=7;
132 4 else tc_ADCCurrentKey = 8;*/
133 4 #endif
134 4
135 4
136 4 if ((gc_ADCOldKey & 0x0f) == tc_ADCCurrentKey)
137 4 {//按鍵未釋放
138 5 if (tc_ADCCurrentKey != KEY_NONEKEY)
139 5 {
140 6 if (gc_LongKeyTimer > gc_LongKeyDelay)
141 6 {
142 7 gc_ADCOldKey = gc_ADCOldKey | 0x10; //長按鍵
143 7 gc_KeyValue = gc_ADCOldKey & 0x7f;
144 7 gc_LongKeyTimer = REPEATKEY_DELAYVALUE; //設置重復按鍵延時起始值
145 7 gc_LongKeyDelay = (gc_LongKeyDelay < MIN_REPEATKEYDELAY)?MIN_REPEATKEYDELAY:gc_LongKeyDelay-3; //
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -