main.lst
来自「单片机C语言程序设计实训100例」· LST 代码 · 共 175 行
LST
175 行
C51 COMPILER V8.08 MAIN 08/12/2009 16:48:39 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /*************** writer:shopping.w ******************/
2 #include <reg52.h>
3 #include <string.h>
4 #define uchar unsigned char
5 #define uint unsigned int
6 void Initialize_LCD();
7 void ShowString(uchar,uchar,uchar *);
8 sbit K1 = P3^0;
9 sbit K2 = P3^1;
10 sbit K3 = P3^2;
11
12 uchar code Prompt[]="PRESS K1--K4 TO START DEMO PROG";
13 uchar const Line_Count = 6;
14 uchar code Msg[][80]=
15 {
16 "Many CAD users dismiss",
17 "process of creating PCB",
18 "of view.with PCB layout",
19 "placement and track routing,",
20 "can often be the most time",
21 "And if you use circuit simulation",
22 "you are going to spend even more"
23 };
24 uchar Disp_Buffer[32];
25 void Delayxms(uint ms)
26 {
27 1 uchar i;
28 1 while(ms--)
29 1 {
30 2 for(i=0;i<120;i++);
31 2 }
32 1 }
33
34 void V_Scroll_Display()
35 {
36 1 uchar i,j,k = 0;
37 1 uchar *p = Msg[0];
38 1 uchar *q = Msg[Line_Count] + strlen(Msg[Line_Count]);
39 1 while(p<q)
40 1 {
41 2 for(i=0;(i<16)&&(p<q);i++)
42 2 {
43 3 if(((i==0)||(i==15))&& *p == ' ')
44 3 p++;
45 3 if(*p != '\0')
46 3 {
47 4 Disp_Buffer[i] = *p++;
48 4 }
49 3 else
50 3 {
51 4 if(++k>Line_Count)
52 4 break;
53 4 p = Msg[k];
54 4 Disp_Buffer[i] = *p++;
55 4 }
C51 COMPILER V8.08 MAIN 08/12/2009 16:48:39 PAGE 2
56 3 }
57 2 for(j=i;j<16;j++)
58 2 Disp_Buffer[j]=' ';
59 2 while(F0)
60 2 Delayxms(5);
61 2 ShowString(0,0," ");
62 2 Delayxms(150);
63 2 while(F0)
64 2 Delayxms(5);
65 2 ShowString(0,1,Disp_Buffer);
66 2 Delayxms(150);
67 2 while(F0)
68 2 Delayxms(5);
69 2 ShowString(0,0,Disp_Buffer);
70 2 ShowString(0,1," ");
71 2 Delayxms(150);
72 2 }
73 1 ShowString(0,0," ");
74 1 ShowString(0,1," ");
75 1 }
76
77 void H_Scroll_Display()
78 {
79 1 uchar m,n,t = 0,L=0;
80 1 uchar *p = Msg[0];
81 1 uchar *q = Msg[Line_Count] + strlen(Msg[Line_Count]);
82 1 for(m=0;m<16;m++)
83 1 Disp_Buffer[m]=' ';
84 1 while(p<q)
85 1 {
86 2 if((m=16||m==31)&& *p == ' ')
87 2 p++;
88 2 for(m=16;m<32&&p<q;m++)
89 2 {
90 3 if(*p != '\0')
91 3 {
92 4 Disp_Buffer[m] = *p++;
93 4 }
94 3 else
95 3 {
96 4 if(++t>Line_Count)
97 4 break;
98 4 p = Msg[t];
99 4 Disp_Buffer[m] = *p++;
100 4 }
101 3 }
102 2 for(n=m;n<32;n++)
103 2 Disp_Buffer[n]=' ';
104 2 for(m=0;m<=16;m++)
105 2 {
106 3 while(F0)
107 3 Delayxms(5);
108 3 ShowString(0,L,Disp_Buffer+1);
109 3 while(F0)
110 3 Delayxms(5);
111 3 Delayxms(20);
112 3 }
113 2 L = (L==0)? 1:0;
114 2 Delayxms(200);
115 2 }
116 1 if(L==1)
117 1 ShowString(0,1," ");
C51 COMPILER V8.08 MAIN 08/12/2009 16:48:39 PAGE 3
118 1 }
119
120 void EX_INT0() interrupt 0
121 {
122 1 F0 = !F0;
123 1 }
124
125 void main()
126 {
127 1 uint Count = 0;
128 1 IE = 0x81;
129 1 IT0 = 1;
130 1 F0 = 0;
131 1 Initialize_LCD();
132 1 ShowString(0,0,Prompt);
133 1 ShowString(0,1,Prompt+16);
134 1 while(1)
135 1 {
136 2 if(K1 == 0)
137 2 {
138 3 V_Scroll_Display();
139 3 Delayxms(200);
140 3 }
141 2 else if(K2 == 0)
142 2 {
143 3 H_Scroll_Display();
144 3 Delayxms(200);
145 3 }
146 2 }
147 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 797 ----
CONSTANT SIZE = 609 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 33 19
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?