📄 24c16.lst
字号:
C51 COMPILER V7.04 24C16 10/23/2004 15:21:28 PAGE 1
C51 COMPILER V7.04, COMPILATION OF MODULE 24C16
OBJECT MODULE PLACED IN 24c16.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 24c16.c ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 //这是24c16以内的程序,如果大于16则在多加一个高位地址 #include <at89x52.h>
2 #include <reg52.h>
3 #include <intrins.h>
4 #define uchar unsigned char
5
6 sbit ee_sda=P1^3;
7 sbit ee_scl=P1^2;
8
9 bit ee_end_fg;
10
11 void start(void)
12 {
13 1 ee_sda=1;
14 1 ee_scl=1;
15 1 _nop_();
16 1 _nop_();
17 1 _nop_();
18 1 ee_sda=0;
19 1 _nop_();
20 1 _nop_();
21 1 _nop_();
22 1 }
23 void stop(void)
24 {
25 1 ee_sda=0;
26 1 _nop_();
27 1 _nop_();
28 1 ee_scl=1;
29 1 _nop_();
30 1 _nop_();
31 1 ee_sda=1;
32 1 }
33 void ee_tx(uchar ee_data)
34 {
35 1 uchar i=8;
36 1 do
37 1 {
38 2 ee_scl=0;
39 2 ee_sda=ee_data&0x80;
40 2 ee_data<<=1;
41 2 ee_scl=1;
42 2 i--;
43 2 }
44 1 while (i);
45 1 do
46 1 {
47 2 ee_scl=0;
48 2 _nop_();
49 2 _nop_();
50 2 _nop_();
51 2 _nop_();
52 2 ee_scl=1;
53 2 }
54 1 while (ee_sda);
55 1 ee_scl=0;
C51 COMPILER V7.04 24C16 10/23/2004 15:21:28 PAGE 2
56 1 }
57 uchar ee_rx(void)
58 {
59 1 uchar i=8,ee_data;
60 1 do
61 1 {
62 2 ee_data<<=1;
63 2 ee_scl=0;
64 2 _nop_();
65 2 _nop_();
66 2 ee_scl=1;
67 2 ee_data|=ee_sda;
68 2 i--;
69 2 }
70 1 while (i);
71 1 ee_scl=0;
72 1 if (!ee_end_fg)
73 1 {
74 2 ee_sda=0;
75 2 _nop_();
76 2 _nop_();
77 2 ee_scl=1;
78 2 _nop_();
79 2 _nop_();
80 2 _nop_();
81 2 _nop_();
82 2 ee_scl=0;
83 2 }
84 1 ee_sda=1;
85 1 return(ee_data);
86 1 }
87 void ee_read(uchar ee_addrh,uchar ee_addrl,uchar ee_num,uchar *sp)
88 {
89 1 ee_end_fg=0;
90 1 start();
91 1 ee_addrh&=7;
92 1 ee_addrh<<=1;
93 1 ee_addrh|=0xa0;
94 1 ee_tx(ee_addrh);
95 1 ee_tx(ee_addrl);
96 1 start();
97 1 ee_tx(ee_addrh|1);
98 1 do
99 1 {
100 2 if (ee_num==1)
101 2 ee_end_fg=1;
102 2 *sp=ee_rx();
103 2 sp++;
104 2 ee_num--;
105 2 }
106 1 while (ee_num);
107 1 stop();
108 1 }
109 void ee_write(uchar ee_addrh,uchar ee_addrl,uchar ee_num,uchar *sp)
110 {
111 1 start();
112 1 ee_addrh&=7;
113 1 ee_addrh<<=1;
114 1 ee_addrh|=0xa0;
115 1 ee_tx(ee_addrh);
116 1 ee_tx(ee_addrl);
117 1 do
C51 COMPILER V7.04 24C16 10/23/2004 15:21:28 PAGE 3
118 1 {
119 2 ee_tx(*sp);
120 2 sp++;
121 2 ee_num--;
122 2 }
123 1 while (ee_num);
124 1 stop();
125 1 }
126 //==========================================================
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 225 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 12
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -