?? main.lst
字號:
C51 COMPILER V8.02 MAIN 03/31/2009 11:48:53 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c LARGE BROWSE DEBUG OBJECTEXTEND
line level source
1 #include<AT89X51.H>
2 #include "INTRINS.H"
3
4 #define LCD_BUS P0
5 sbit RS= P2^5;
6 sbit RW=P2^6;
7 sbit E =P2^7;
8 // sbit pcb=P1^3;
9 // sbit RS= P1^0;
10 //sbit RW=P1^1;
11 //sbit E =P1^2;
12
13 //extern unsigned char code str[14][3];//={":0",":1",":2",":3",":4",":5",":6",":7",":8",":9"};
14
15
16
17
18
19 ////////////////////////////////////
20
21 ////////////////////////////////////
22
23 void delay(unsigned int t) ; //延時t倍///
24
25 unsigned char check_bf(unsigned char Address_AC); //LCD標志位查詢//
26 void write_data(unsigned char dispdata); //寫數據//
27 void write_comand(unsigned char cmdcode); //寫命令//
28
29 void lcd_init(); ///LCD初始化//
30 void stringdisp (unsigned char code *str,unsigned char adress); //顯示字符串//
31
32 void data_disp(unsigned int disp_data,unsigned char adress); //數字顯示
33 void disp_graph(); //總界面:教室燈控系統
34 void disp_graph_password(); //密碼輸入登錄界面
35 void disp_graph_set(); //系統設置總界面
36 /////////////////////////////////////////////////////
37
38 unsigned char code str[]=" 教室燈控系統 "; //登陸總界面
39 unsigned char code str1[]=" ●登陸界面 →";
40 // unsigned char code str2[]=" ●設置界面 →";
41
42 unsigned char code str_password1[]="請輸入登錄密碼:"; //輸入密碼界面
43 unsigned char code str_password2[]=" ****** ";
44 unsigned char code str_password3[]=" 1 2 3 4 5 6 ";
45 unsigned char code str_password4[]=" 6 7 8 9 ";
46
47 unsigned char code str_set1[]="設置選項: "; //設置總界面
48 unsigned char code str_set2[]="●密碼設置 →";
49 unsigned char code str_set3[]="●系統時間設置→";
50 unsigned char code str_set4[]="●定時時間設置→";
51
52 unsigned char code str3[]="1234567891234567";
53
54 // unsigned char code str12[14][3]={"1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9 ","10","11","12","13","14"
-,};
C51 COMPILER V8.02 MAIN 03/31/2009 11:48:53 PAGE 2
55
56 //////////////////////////////////////////////////////////////////
57 void main()
58 {
59 1 unsigned char m;
60 1
61 1 //init591();
62 1 // pcb=1;
63 1 lcd_init();
64 1 LCD_BUS=0X00;
65 1 //disp_graph(); //登陸總界面
66 1 disp_graph_password();
67 1 // disp_graph_set();
68 1
69 1
70 1 //stringdisp(&str3,0x80); ///////顯示開機畫面//////
71 1
72 1 //write_comand(0x85);
73 1 // stringdisp("1",0x88);
74 1 // data_disp(198,0x98); //數字顯示
75 1
76 1
77 1
78 1
79 1 /* m=check_bf(); //測試LCD屏狀態查詢中AC的返回值是否正確
80 1 delay(10);
81 1 if(m=0x87)
82 1 {
83 1 // write_comand(0x30);
84 1 write_comand(0x88);
85 1 write_data('1'); }
86 1 else
87 1 {
88 1 //write_comand(0x30);
89 1 write_comand(0x88);
90 1 write_data('0');
91 1 } */
92 1
93 1 delay(100);
94 1 }
*** WARNING C280 IN LINE 59 OF MAIN.C: 'm': unreferenced local variable
95
96 /**********************************************************************
97 函數原型: void delay(unsigned int t)
98 入口參數:
99 t : 延時程序t倍的100us
100 出口參數: 無
101 返 回 值: 無
102 說 明: LCD液晶延時子程序t倍100us
103 **********************************************************************/
104 ///////////////////延時程序/////////////////////////////////////
105
106 void delay(unsigned int t) //延時程序t倍100us
107 {
108 1 unsigned char j;
109 1 unsigned int i;
110 1 for(i=0;i<t;i++)
111 1 for(j=0;j<29;j++);
112 1
113 1 }
114 /***********************************************************************
115 函數原型:check_bf(unsigned char Address_AC)
C51 COMPILER V8.02 MAIN 03/31/2009 11:48:53 PAGE 3
116 入口參數:無
117 出口參數:無
118
119 返回值:
120 Address_AC:當前狀態的地址(一個無符號字符)
121 功能說明:LCD液晶的狀態BF查詢和DDRAM的地址查詢
122 ************************************************************************/
123 ////////////////////////////查詢BF///////////////////////////////////////
124
125 unsigned char check_bf(unsigned char Address_AC)
126 {
127 1 unsigned char BF; ////忙標志位,BF是某字節的一位,是D7位,如果為1,則忙//////
128 1 LCD_BUS=0x00 ;
129 1 do
130 1 {
131 2 RS=0;
132 2 RW=1;
133 2 E=1;
134 2 BF=LCD_BUS; /////此處BF定義不是一個位,而是一個字節,不過在處理中代表標志位bf///
135 2 _nop_();
136 2 E=0;
137 2 Address_AC=BF;
138 2 BF=BF&0x80; ////取出BF////
139 2 }while( BF!=0x00 ) ; //////判斷是否忙?///////
140 1 Address_AC=Address_AC&0x7f; ///讀出DDRAM的地址指針AC的值
141 1 delay(5) ;
142 1 return(Address_AC);
143 1 }
144 /**********************************************************************
145 函數原型:write_comand(unsigned char cmdcode)
146 入口參數:
147 cmdcode : 命令字 (0x01:清屏)
148 出口參數: 無
149 返 回 值: 無
150 說 明: 對lcd寫命令字
151 **********************************************************************/
152 /////////////////////////寫命令子程序//////////////////////////////////
153
154 void write_comand(unsigned char cmdcode)
155 {
156 1 check_bf();
*** WARNING C209 IN LINE 156 OF MAIN.C: '_check_bf': too few actual parameters
157 1 RS=0;
158 1 RW=0;
159 1 E=1;
160 1 LCD_BUS=cmdcode;
161 1 _nop_();
162 1 E=0;
163 1 delay(5) ;
164 1 }
165 /***********************************************************************
166 函數原型:write_data(unsigned char dispdata)
167 入口參數:
168 dispdata:寫入lcd要顯示內容
169 出口參數:無
170 返回值: 無
171 功能說明:LCD液晶的數據寫入指令
172 ************************************************************************/
173 //////////////////////////寫數據子程序///////////////////////////////////
174
175 void write_data(unsigned char dispdata)
176 {
C51 COMPILER V8.02 MAIN 03/31/2009 11:48:53 PAGE 4
177 1 check_bf();
*** WARNING C209 IN LINE 177 OF MAIN.C: '_check_bf': too few actual parameters
178 1 RS=1;
179 1 RW=0;
180 1 E=1;
181 1 LCD_BUS=dispdata;
182 1 _nop_();
183 1 E=0;
184 1 }
185 /******************************************************************
186 函數:lcd_init()
187 入口參數:無
188 出口參數:無
189 返回值:無
190 功能說明:LCD液晶的初始化
191 ********************************************************************/
192 /////////////////////////液晶初始化////////////////////////////////
193 void lcd_init()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -