📄 24c01.lst
字号:
C51 COMPILER V7.06 24C01 09/17/2007 10:01:04 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE 24C01
OBJECT MODULE PLACED IN .\24c01.obj
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE ..\XD_dep\24c01.c BROWSE DEBUG OBJECTEXTEND PRINT(.\24c01.lst) OBJECT(.\24c
-01.obj)
stmt level source
1 #include "reg51.h"
2 #include "intrins.h"
3
4 //sbit SCL= P3^7;
5 //sbit SDA= P3^6;
6
7
8
9 delay()
10 {
11 1 unsigned int i=1200;
12 1 while(i--);
13 1 }
14 /*----------------------------------------------------------------------------
15 调用方式:write_8bit(unsigned char ch) ﹫2001/03/23
16 函数说明:内函数,私有,用户不直接调用。
17 -------------------------------------------------------------------------------
18 */
19 void write_8bit(unsigned char ch)
20 {
21 1 unsigned char i=8;
22 1 SCL=0;
*** ERROR C202 IN LINE 22 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
23 1 _nop_();_nop_();_nop_();_nop_();_nop_();
24 1 while (i--)
25 1 {
26 2 SDA=(bit)(ch&0x80);
*** ERROR C202 IN LINE 26 OF ..\XD_DEP\24C01.C: 'SDA': undefined identifier
27 2 _nop_();_nop_();_nop_();_nop_();_nop_();
28 2 ch<<=1;
29 2 SCL=1;
*** ERROR C202 IN LINE 29 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
30 2 _nop_();_nop_();_nop_();_nop_();_nop_();
31 2 SCL=0;
*** ERROR C202 IN LINE 31 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
32 2 _nop_();_nop_();_nop_();_nop_();_nop_();
33 2 }
34 1 _nop_();_nop_();_nop_();_nop_();_nop_();
35 1 _nop_();_nop_();_nop_();_nop_();_nop_();
36 1 }
37
38 /*------------------------------------------------------------------------------
39 调用方式:void ACK(void) ﹫2001/03/23
40 函数说明:内函数,私有,用户不直接调用。
41 -------------------------------------------------------------------------------
42 */
43 void ACK(void)
44 {
45 1 unsigned char time_1;
46 1 SDA=1;
*** ERROR C202 IN LINE 46 OF ..\XD_DEP\24C01.C: 'SDA': undefined identifier
47 1 SCL=0;
*** ERROR C202 IN LINE 47 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
48 1 _nop_();_nop_();_nop_();_nop_();_nop_();
C51 COMPILER V7.06 24C01 09/17/2007 10:01:04 PAGE 2
49 1 SCL=1;
*** ERROR C202 IN LINE 49 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
50 1 time_1=5;
51 1 while(SDA) {if (!time_1) break;} //ACK
*** ERROR C202 IN LINE 51 OF ..\XD_DEP\24C01.C: 'SDA': undefined identifier
52 1 SCL=0;
*** ERROR C202 IN LINE 52 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
53 1 _nop_();_nop_();_nop_();_nop_();_nop_();
54 1 }
55
56
57 unsigned char ReadIIC_24C01(unsigned char address)
58 {
59 1 unsigned char ddata=0;
60 1 unsigned char i=8;
61 1
62 1 SCL=1;
*** ERROR C202 IN LINE 62 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
63 1 _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); //Tsu:STA
64 1 SDA=0;
*** ERROR C202 IN LINE 64 OF ..\XD_DEP\24C01.C: 'SDA': undefined identifier
65 1 _nop_();_nop_();_nop_();_nop_();_nop_();_nop_(); //Thd:STA
66 1 SCL=0; //START
*** ERROR C202 IN LINE 66 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
67 1
68 1 write_8bit( (address<<1) | 0x01); //写页地址和操作方式
69 1 ACK();
70 1
71 1 while (i--)
72 1 {
73 2 SDA=1;
*** ERROR C202 IN LINE 73 OF ..\XD_DEP\24C01.C: 'SDA': undefined identifier
74 2 ddata<<=1;
75 2 SCL=0;_nop_();_nop_();_nop_();_nop_();_nop_();SCL=1;
*** ERROR C202 IN LINE 75 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
*** ERROR C202 IN LINE 75 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
76 2 if (SDA) ddata|=0x01;
*** ERROR C202 IN LINE 76 OF ..\XD_DEP\24C01.C: 'SDA': undefined identifier
77 2 }
78 1
79 1 SCL=0;_nop_();SCL=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
*** ERROR C202 IN LINE 79 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
*** ERROR C202 IN LINE 79 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
80 1 SDA=0;_nop_();SCL=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
*** ERROR C202 IN LINE 80 OF ..\XD_DEP\24C01.C: 'SDA': undefined identifier
*** ERROR C202 IN LINE 80 OF ..\XD_DEP\24C01.C: 'SCL': undefined identifier
81 1 SDA=1; //STOP
*** ERROR C202 IN LINE 81 OF ..\XD_DEP\24C01.C: 'SDA': undefined identifier
82 1 delay();
83 1 return ddata;
84 1
85 1 }
86
87 /*
88 void WriteIIC_24C01(unsigned char address,unsigned char ddata)
89 {
90
91 SCL=1;
92 _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); //Tsu:STA
93 SDA=0;
94 _nop_();_nop_();_nop_();_nop_();_nop_();_nop_(); //Thd:STA
95 SCL=0; //START
C51 COMPILER V7.06 24C01 09/17/2007 10:01:04 PAGE 3
96
97 write_8bit( (address<<1) & 0xfe); //写页地址和操作方式,对于24C32-
98 24C256,page不起作用
99 //ACK();
100 // write_8bit(ddata); //发送数据
101 //ACK();
102 // SDA=0;
103 // _nop_();SCL=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
104 // SDA=1; //STOP
105 // delay();
106 }
107 */
C51 COMPILATION COMPLETE. 0 WARNING(S), 21 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -