📄 main.lst
字号:
C51 COMPILER V7.08 MAIN 11/27/2006 23:20:45 PAGE 1
C51 COMPILER V7.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 TABS(8)
line level source
1 // Khai bao cac file header
2 #include <AT89X52.H>
3 #include <Kit8051.h>
4
5 // Khai bao cac bien toan cuc
6 unsigned char code string1[] = "Truong CDSP HN";
7 unsigned char code string2[] = "8051 Starter Kit";
8
9 // Khai bao cac ham
10 void InitSystem(void);
11 void Delay(unsigned int n);
12 void InitLCD(void);
13 void WriteCommand(unsigned char command);
14 void WriteCharacter(unsigned char character);
15 void WriteLCD(unsigned char x);
16 void SendString2LCD(unsigned char code *p);
17 void DisplayText(void);
18
19 // Dinh nghia cac ham
20 void InitSystem(void)
21 {
22 1 // Cam LCD
23 1 LCD_E = 0;
24 1 // Sang den backlight
25 1 LCD_BL = 0;
26 1 // Tre de LCD tu khoi tao ben trong (it nhat 15ms)
27 1 Delay(100);
28 1 // Tat den backlight
29 1 LCD_BL = 1;
30 1 InitLCD();
31 1 }
32 void Delay(unsigned int n)
33 {
34 1 unsigned int i,j;
35 1 for(i=0;i<n;i++)
36 1 for(j=0;j<100;j++);
37 1 }
38 void InitLCD(void)
39 {
40 1 WriteCommand(0x30);
41 1 WriteCommand(0x30);
42 1 WriteCommand(0x30);
43 1
44 1 // 8 bit, 2 lines, font 5x7
45 1 WriteCommand(0x38);
46 1 // Display on, hide cursor
47 1 WriteCommand(0x0C);
48 1
49 1 // Xoa man hinh
50 1 WriteCommand(0x01);
51 1 }
52 void DisplayText(void)
53 {
54 1 // Dich con tro den vi tri thu 2, dong thu nhat
55 1 WriteCommand(0x81);
C51 COMPILER V7.08 MAIN 11/27/2006 23:20:45 PAGE 2
56 1 SendString2LCD(string1);
57 1 // Dich con tro den dau dong thu hai
58 1 WriteCommand(0xC0);
59 1 SendString2LCD(string2);
60 1 }
61 void WriteLCD(unsigned char x)
62 {
63 1 LCD_RW = 0;
64 1 LCD_DATA = x;
65 1
66 1 LCD_E = 1;
67 1 LCD_E = 0;
68 1 Delay(5);
69 1 }
70 void WriteCommand(unsigned char command)
71 {
72 1 LCD_RS = 0;
73 1 WriteLCD(command);
74 1 }
75 void WriteCharacter(unsigned char character)
76 {
77 1 LCD_RS = 1;
78 1 WriteLCD(character);
79 1 }
80 void SendString2LCD(unsigned char code *p)
81 {
82 1 unsigned char i=0;
83 1 while(p[i]!=0)
84 1 {
85 2 WriteCharacter(p[i]);
86 2 i++;
87 2 Delay(200);
88 2 }
89 1 }
90 // Chuong trinh chinh
91 void main(void)
92 {
93 1 // Khoi tao he thong
94 1 InitSystem();
95 1 DisplayText();
96 1 // Vong lap vo tan
97 1 while(1);
98 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 170 ----
CONSTANT SIZE = 32 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 2
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -