用keil c对绝对地址的访问
源代码在线查看: 外部口读写.lst
C51 COMPILER V8.02 外部口读写 11/01/2000 22:26:55 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE 外部口读写
OBJECT MODULE PLACED IN 外部口读写.OBJ
COMPILER INVOKED BY: D:\keil\C51\BIN\C51.EXE 外部口读写.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include //包括一个52标准内核的头文件
2 #define uchar unsigned char //定义一下方便使用
3 #define uint unsigned int
4
5 void Delay(uchar i)
6 {
7 1 uchar m;
8 1 uchar n;
9 1
10 1 for(m=0;m 11 1 {
12 2 for(n=0;n 13 2 {
14 3 //_nop_;
15 3 }
16 2 }
17 1
18 1 }
19
20
21 main()
22 {
23 1 uchar xdata *Key_addr; /*定义Key的地址*/
24 1 uchar xdata *Led_addr; /*定义led灯的地址指针*/
25 1 Led_addr=0xf0;
26 1 Key_addr=0x80;
27 1
28 1 while(1)
29 1 {
30 2 uchar key;
31 2 key=*Key_addr; /*取键值*/
32 2 *Led_addr=key; /*显示键值*/
33 2 Delay(255); /*延时*/
34 2 *Led_addr=0x0f;
35 2 Delay(255);
36 2 *Led_addr=0xf0;
37 2 Delay(255);
38 2
39 2
40 2 }
41 1
42 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 60 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 3
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)