?? 復(fù)件 radio72131.lst
字號:
C51 COMPILER V7.50 復(fù)件_RADIO72131 10/22/2008 11:35:24 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE 復(fù)件_RADIO72131
OBJECT MODULE PLACED IN 復(fù)件 RADIO72131.OBJ
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE 復(fù)件 RADIO72131.C BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <REGX51.H>
2 #include <intrins.h>
3 #define uchar unsigned char
4 #define uint unsigned int
5 #define ulong unsigned long
6 #define doo P3_4
7 #define cl P3_5
8 #define di P3_6
9 #define ce P3_7
10 #define lamp P3_3
11 #define lamp2 P2_2
12 //////led///////////
13 #define led1 P1_3
14 #define led2 P1_2
15 #define led3 P1_1
16 #define led4 P1_0
17 unsigned char code led[]={192,249,164,176,153,146,130,248,128,144,255};//
18 /////////////////////
19 #define k1 P2_0
20 #define k2 P2_3
21 #define k3 P2_7
22 ////////iic////////
23 #define sda P3_2
24 #define scl P3_0
25 ///////////////
26 uchar gw,sw,bw,qw;
27 uint freq_fm,freq_am;
28 bit bandb;
29 delay(uint i)
30 { uchar k;
31 1 while(--i)
32 1 {
33 2 for(k=0;k<100;k++);
34 2 }
35 1 }
36 /////////I2C///////////////////
37 //////////I2C開始///////////
38 start()
39 {
40 1
41 1 sda=1;
42 1 scl=1;
43 1 _nop_();
44 1 sda=0;
45 1 _nop_();
46 1 scl=0;
47 1
48 1 }
49 //////////I2C停止///////// /
50 stop()
51 {
52 1 sda=0;
53 1 _nop_();
54 1 scl=1;
55 1 _nop_();
C51 COMPILER V7.50 復(fù)件_RADIO72131 10/22/2008 11:35:24 PAGE 2
56 1 sda=1;
57 1 }
58 /////////I2C讀一個字節(jié)//////////////
59 unsigned char rd(void)
60 {
61 1 uchar out=0;
62 1 uchar i; //有8位數(shù)據(jù)
63 1
64 1 for(i=0;i<8;i++)
65 1 { sda=1;
66 2 scl=1;
67 2 out|=sda;
68 2 scl=0;
69 2 if(i<7) out<<=1;//下一位
70 2 }
71 1 sda=1;
72 1 scl=0;
73 1 return out;
74 1 }
75
76 /////////////////////I2C寫一個字節(jié)/////////////////////////
77 void wd(unsigned char dd) //
78 {
79 1 uchar in,i=8;
80 1 in=dd;
81 1 while(i--)
82 1 {
83 2 sda=(in&0x80);
84 2 scl=1;
85 2 delay(1);
86 2 scl=0;
87 2 in<<=1;
88 2 }
89 1 sda=1;
90 1 scl=1;
91 1 }
92
93 //////////////////I2C不應(yīng)答//////////
94 noack()
95 {
96 1 sda=1;
97 1 scl=1;
98 1 delay(2);
99 1 scl=0;
100 1 delay(2);
101 1 sda=0;
102 1
103 1 }
104 //////////I2C等待器件應(yīng)答///////////////
105 ack(){
106 1 uchar i=255;
107 1 while (--i) //等待ASK
108 1 { delay(1);
109 2 sda=1; //釋放總線
110 2 if (sda==0) break; //跳出
111 2 scl=0;
112 2 }
113 1 scl=0;
114 1 }
115 ///////////////I2C讀24C16///////////
116 uchar r_2402(uint add)
117 { uchar dd;
C51 COMPILER V7.50 復(fù)件_RADIO72131 10/22/2008 11:35:24 PAGE 3
118 1 start(); //開始
119 1 wd(0xa0);ack(); //寫地址
120 1 wd(add);ack();//寫讀的地址
121 1 start();// 重新啟動
122 1 wd(0xa1);ack(); //寫 器件地址
123 1 dd=rd(); //讀出數(shù)據(jù)
124 1 noack(); //不應(yīng)答
125 1 stop(); //停止
126 1 return dd;
127 1 }
128 ///////////////////I2C寫24C16////////////////////////////
129 void w_2402(uchar add,uchar dat) //(地址,數(shù)據(jù) )
130 {
131 1 start(); //開始
132 1 wd(0xa0);ack(); //寫寫的數(shù)據(jù)
133 1 wd(add);ack();//
134 1 wd(dat); ack();
135 1 stop(); //停止
136 1 }
137
138
139 /////////主程序//////////////
140 main()
141 {
142 1
143 1 while(1)
144 1 {
145 2
146 2 bcd();//
*** WARNING C206 IN LINE 146 OF 復(fù)件 RADIO72131.C: 'bcd': missing function-prototype
147 2 display();//調(diào)顯示
*** WARNING C206 IN LINE 147 OF 復(fù)件 RADIO72131.C: 'display': missing function-prototype
148 2
149 2
150 2 }
151 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 239 ----
CONSTANT SIZE = 11 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 8 1
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 2 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -