📄 mcs51-项目开发经典.lst
字号:
C51 COMPILER V7.06 MCS51__钅靠猒_____ 12/07/2008 20:01:11 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MCS51__钅靠猒_____
OBJECT MODULE PLACED IN MCS51-项目开发经典.OBJ
COMPILER INVOKED BY: E:\Program Files\Keilu2\C51\BIN\C51.EXE MCS51-项目开发经典.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 //=================================================================================================
2 // 项目名:MCS51-项目开发经典
3 // 硬件文件名:51Studay.DDB
4 // 程序组目录名:MCS51-项目开发经典
5 // 开始时间:2007年5月21日
6 // 完成时间:2007年6月10日
7 //-------------------------------------------------------------------------------------------------
8 // 程序中用到哪些C51标准函数,就需要把该函数对应的头文件包含进来
9 //-------------------------------------------------------------------------------------------------
10 #include <intrins.h>
11 #include <string.h>
12 #include <absacc.h>
13 #include <reg52.h>
14 //-------------------------------------------------------------------------------------------------
15 // 为提高书写效率做以下宏定义
16 //-------------------------------------------------------------------------------------------------
17 #define uchar unsigned char
18 #define uint unsigned int
19 #define ulong unsigned long
20 #define CLOSE 1
21 #define OPEN 0
22 //-------------------------------------------------------------------------------------------------
23 // 液晶模块12232C-3操控位宏定义,液晶模块内部驱动器为ST7920
24 //-------------------------------------------------------------------------------------------------
25 #define x 0x80
26 #define y 0x80
27 #define comm 0
28 #define dat 1
29
30 sbit cs = P2^0; //
31 sbit std = P2^1; //
32 sbit sclk = P2^2; //
33
34 sbit rs = P2^0; //H=data; L=command;
35 sbit rw = P2^1; //H=read; L=write;
36 sbit e = P2^2; //input enable;
37 sbit busy = P0^7; //lcd busy bit
38
39 uchar read_data_high;
40 uchar read_data_low;
41
42 sbit LCM_LED =P2^3;
43
44 uchar code tab1[]={"无敌男人刘宝宇!" //第一行显示内容
45 "杭州电子科技大!"};//第二行显示内容
46
47 uchar code tab3[]={"&&疯狂工作室!&&" //第一行显示内容
48 "07048055号学生!"};//第二行显示内容
49
50 uchar code Picture_kfjd[]={//图像lcm_pic_kfjd.bmp,宽度x高度=128x32
51 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
52 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
53 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
54 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
55 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
C51 COMPILER V7.06 MCS51__钅靠猒_____ 12/07/2008 20:01:11 PAGE 2
56 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
57 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
58 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
59 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
60 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
61 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
62 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
63 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
64 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
65 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
66 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
67 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
68 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
69 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
70 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
71 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
72 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
73 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
74 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
75 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
76 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
77 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
78 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
79 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
80 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
81 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
82 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
83 };
84
85 uchar t1_delay_time;//50毫秒计数器累加变量,在T2中断里累加
86
87 //-------------------------------------------------------------------------------------------------
88 // 函数声明
89 //-------------------------------------------------------------------------------------------------
90 void init_cpu(void);
91
92 void init_lcd (void);
93
94 void uart_byte_out(uchar uart_data_out);
95 void uart_string_out(char * char_array);
96
97 void write_lcd (uchar dat_comm,uchar content);
98 uchar read_lcd(void);
99 void check_busy (void);
100 void init_lcd (void);
101 void image_clear(void);
102 void lcm_clear_ram (void);
103 void chinese_or_character_display (uchar code *char_name);
104 void image_display (uchar code *img);
105 void line_display (uchar y_coordinate, uchar x_coordinate, uint show_data);
106 uint line_read (uchar y_coordinate, uchar x_coordinate);
107
108 //=================================================================================================
109 //===================== ================================================
110 //===================== 主程序 ================================================
111 //===================== ================================================
112 //=================================================================================================
113 void main (void)
114 {
115 1 uint reader;
116 1 uchar i;
117 1 init_cpu();
C51 COMPILER V7.06 MCS51__钅靠猒_____ 12/07/2008 20:01:11 PAGE 3
118 1 init_lcd ();
119 1 LCM_LED = OPEN;
120 1 uart_string_out("LCM test ok!");
121 1
122 1 lbyloop:
123 1
124 1 /* line_display (10, 0 ,0xfaaf);
125 1 reader = line_read (10, 0);
126 1 //reader = read_data_high;
127 1 //reader = (reader<<8) | read_data_low;
128 1 line_display (12, 0 ,reader);
129 1
130 1
131 1 for(t1_delay_time=0;t1_delay_time<120;);//延时10秒*/
132 1
133 1 image_clear();
134 1
135 1 chinese_or_character_display (tab1);//"
136 1 for(t1_delay_time=0;t1_delay_time<100;);//延时3秒
137 1 // for(i=0;i<8;i++)
138 1 // {
139 1 // for (t1_delay_time=0;t1_delay_time<100;t1_delay_time++) write_lcd (comm,0x18);
140 1 // }
141 1
142 1
143 1 chinese_or_character_display (tab3);//"
144 1 for(t1_delay_time=0;t1_delay_time<100;);//延时3秒
145 1 lcm_clear_ram();
146 1
147 1 goto lbyloop;
148 1
149 1 }
*** WARNING C280 IN LINE 115 OF MCS51-项目开发经典.C: 'reader': unreferenced local variable
*** WARNING C280 IN LINE 116 OF MCS51-项目开发经典.C: 'i': unreferenced local variable
150
151 //########################## 主程序结束 #########################################################
152 //########################## 子程序开始 #########################################################
153
154 //=================================================================================================
155 // 函数功能:CPU初始化函数
156 // 串口波特率可以由T1或T2产生,本例中用T1产生波特率
157 // T2用于50毫秒精确定时
158 // T0用于PWM控制中频率的时基
159 //=================================================================================================
160 void init_cpu(void)
161 {
162 1 TMOD=0x12;//T1为16位计数器,T0为8位自动重装载计数器
163 1
164 1 ET1=1;
165 1 TH1=0x4c;//11.0592M晶振时T1定时时间长度为50毫秒
166 1 TL1=0x00;
167 1 TR1=1;//T1开始定时
168 1
169 1 T2CON=0x30;//定时器T2工作于波特率发生器方式
170 1 RCAP2H=0xff;//11.0592M晶振,9600bps初值
171 1 RCAP2L=0xdc;
172 1 TH2=0xff;
173 1 TL2=0xdc;
174 1 TR2=1;//允许T2中断
175 1
176 1 SCON=0x40;//串口工作于方式1,启动串口接收
177 1
C51 COMPILER V7.06 MCS51__钅靠猒_____ 12/07/2008 20:01:11 PAGE 4
178 1 EA=1;//CPU中断开放
179 1 }
180 //=================================================================================================
181 // 串口UART操作相关程序
182 //=================================================================================================
183 //函数功能:串口发射1个字节
184 void uart_byte_out(uchar uart_data_out)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -