?? 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 + -