📄 subp.lst
字号:
C51 COMPILER V7.20 SUBP 05/16/2004 23:08:35 PAGE 1
C51 COMPILER V7.20, COMPILATION OF MODULE SUBP
OBJECT MODULE PLACED IN subp.OBJ
COMPILER INVOKED BY: F:\keil\C51\BIN\C51.EXE subp.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <sl811.h>
2 #include <des.h>
3 #include <reg51.h>
4 #include <varial.h>
5
6
7 //--------------------------------
8 // wait usb reset 5ms
9 //-------------------------------
10 void Delay(void)
11 {
12 1 unsigned char i,u;
13 1 for(u=40;u>0;u--)
14 1 {
15 2 i=255;
16 2 while(i--);
17 2 }
18 1 }
19 //*****************************************************************************************
20 // unsigned char Read from SL811H
21 // a = register address
22 // return = data in register
23 //*****************************************************************************************
24 unsigned char SL811Read( unsigned char a)
25 {
26 1 SL811H_ADDR = a;
27 1 return (SL811H_DATA);
28 1 }
29
30 //*****************************************************************************************
31 // unsigned char Write to SL811H
32 // a = register address
33 // d = data to be written to this register address
34 //*****************************************************************************************
35 void SL811Write( unsigned char a, unsigned char d)
36 {
37 1 SL811H_ADDR = a;
38 1 SL811H_DATA = d;
39 1
40 1 }
41
42 //*****************************************************************************************
43 // Buffer Read from SL811H
44 // addr = buffer start address
45 // s = return buffer address where data are to be save/read
46 // c = buffer data length
47 //*****************************************************************************************
48 void SL811BufRead( unsigned char addr, unsigned char *s, unsigned char c)
49 {
50 1 SL811H_ADDR = addr;
51 1 while (c--)
52 1 *s++ = SL811H_DATA;
53 1 }
54
55 //*****************************************************************************************
C51 COMPILER V7.20 SUBP 05/16/2004 23:08:35 PAGE 2
56 // Buffer Write to SL811H
57 // addr = buffer start address
58 // s = buffer address where data are to be written
59 // c = buffer data length
60 //*****************************************************************************************
61 void SL811BufWrite( unsigned char addr, unsigned char *s, unsigned char c)
62 {// unsigned char i;
63 1 SL811H_ADDR = addr;
64 1 while (c--)
65 1 SL811H_DATA = *s++;
66 1
67 1 // for(i=0;i<c;i++)
68 1 // SL811H_DATA = *(s+i);
69 1 }
70
71 //*****************************************************************************************
72 // Swap high and low unsigned char
73 //*****************************************************************************************
74 unsigned short WordSwap(unsigned short input)
75 {
76 1 return(((input&0x00FF)<<8)|((input&0xFF00)>>8));
77 1 }
78
79 //*****************************************************************************************
80 // Audio Control Key Scanning Routine
81 //*****************************************************************************************
82 void audio_key_scan(void)
83 {
84 1
85 1 //if((SL811Read(EP1AControl)&0x01)==0)
86 1 // {
87 1
88 1 key_current=P1;
89 1 if((key_current^0xFF)!=0)
90 1 {
91 2 if(count++ ==5)
92 2 {
93 3 count=0;
94 3 if(key_current==0xfe)
95 3 { key[1]=0x01;
96 4 bkey=1;
97 4 key[0]=1;}
98 3 else if(key_current==0xfd)
99 3 { key[1]=0x02;
100 4 bkey=1;
101 4 key[0]=1;}
102 3 else if(key_current==0xfb)
103 3 { key[1]=0x04;
104 4 bkey=1;
105 4 key[0]=2;}
106 3 else if(key_current==0xf7)
107 3 { key[1]=0x08;
108 4 bkey=1;
109 4 key[0]=2;}
110 3 else if(key_current==0xef)
111 3 { key[4]=0xff;
112 4 bkey=1;
113 4 key[0]=3;}
114 3 else if(key_current==0xdf)
115 3 { key[4]=0x01;
116 4 bkey=1;
117 4 key[0]=3;}
C51 COMPILER V7.20 SUBP 05/16/2004 23:08:35 PAGE 3
118 3 else if(key_current==0xbf)
119 3 { key[5]=0xff;
120 4 bkey=1;}
121 3 else if(key_current==0x7f)
122 3 { key[5]=0x01;
123 4 bkey=1;}
124 3 else
125 3 bkey=0;
126 3 }
127 2 }
128 1 // }
129 1
130 1
131 1
132 1 if(bkey)
133 1 {
134 2 switch(key[0])
135 2 {
136 3 case 1:
137 3 SL811BufWrite(EP1A_Slave_Buf,(unsigned char*)key,0x06);
138 3 EP1A_IN_Arm(EP1A_Slave_Buf,EP1_LEN,ep1_toggle); // Arm Ep1 and toggle data
139 3 key[5]=key[4]=key[1]=key[2]=key[3]=0x00;
140 3 bkey=0;
141 3 break;
142 3 case 2:
143 3 SL811BufWrite(EP1A_Slave_Buf,(unsigned char*)key,0x02);
144 3 EP1A_IN_Arm(EP1A_Slave_Buf,0x02,ep1_toggle); // Arm Ep1 and toggle data
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -