📄 memory clockί
字号:
C51 COMPILER V9.00 LCD 10/29/2012 15:18:33 PAGE 1
C51 COMPILER V9.00, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN Lcd.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Lcd.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg52.h>//包含52单片机头文件
2 #include "Lcd.h"
3 #include "main.h"
4 #include "Assistance.h"
5
6 uchar number;
7
8 void delay(uint z) //延时函数
9 {
10 1 uint x,y;
11 1 for(x=z;x>0;x--)
12 1 for(y=110;y>0;y--);
13 1 }
14
15 void LcdInit()
16 {
17 1 lcden=0;
18 1 write_com(0x38);//设置16X2显示,5X7点阵,8位数据接口
19 1 write_com(0x0c);//设置开显示,不显示光标
20 1 write_com(0x06);//写一个字符后地址指针加1
21 1 write_com(0x01);//显示清零,数据指针清零
22 1 write_com(0x80);//设置显示初始坐标
23 1 }
24
25 void write_com(uchar com)//液晶写命令函数
26 {
27 1 rs=0;
28 1 lcden=0;
29 1 P0=com;
30 1 delay(5);
31 1 lcden=1;
32 1 delay(5);
33 1 lcden=0;
34 1 }
35
36 void write_date(uchar date)//液晶写数据函数
37 {
38 1 rs=1;
39 1 lcden=0;
40 1 P0=date;
41 1 delay(5);
42 1 lcden=1;
43 1 delay(5);
44 1 lcden=0;
45 1 }
46
47 void write_sfm(uchar add,uchar date)//写时分秒函数
48 {
49 1 uchar shi,ge;
50 1 shi=date/10;//分解一个2位数的十位和个位
51 1 ge=date%10;
52 1 write_com(0x80+0x40+add);//设置显示位置
53 1 write_date(0x30+shi);//送去液晶显示十位
54 1 write_date(0x30+ge); //送去液晶显示个位
55 1 }
C51 COMPILER V9.00 LCD 10/29/2012 15:18:33 PAGE 2
56
57 void write_sfm1(uchar add,uchar date)//写时分秒函数
58 {
59 1 uchar ge;
60 1 ge=date%10;
61 1 write_com(0x80+0x40+add);//设置显示位置
62 1 write_date(0x30+ge); //送去液晶显示个位
63 1 }
64
65 void write_sfm2(uchar add,uchar date)//写时分秒函数
66 {
67 1 uchar shi;
68 1 shi=date%10;//分解一个2位数的十位和个位
69 1 write_com(0x80+0x40+add);//设置显示位置
70 1 write_date(0x30+shi);//送去液晶显示十位
71 1 }
72
73 void write_year(uchar add,uchar date)//写时分秒函数
74 {
75 1 uchar shi,ge;
76 1 shi=date/10;
77 1 ge=date%10;
78 1 write_com(0x80+add);//设置显示位置
79 1 write_date(0x30+shi);//送去液晶显示十位
80 1 write_date(0x30+ge); //送去液晶显示个位
81 1 }
82
83 void write_month(uchar add,uchar date)//写月函数
84 {
85 1 uchar shi,ge;
86 1 shi=date/10;//分解一个2位数的十位和个位
87 1 ge=date%10;
88 1 write_com(0x80+add);//设置显示位置
89 1 write_date(0x30+shi);//送去液晶显示十位
90 1 write_date(0x30+ge); //送去液晶显示个位
91 1 }
92
93 void write_day(uchar add,uchar date)//写日函数
94 {
95 1 uchar shi,ge;
96 1 shi=date/10;//分解一个2位数的十位和个位
97 1 ge=date%10;
98 1 write_com(0x80+add);//设置显示位置
99 1 write_date(0x30+shi);//送去液晶显示十位
100 1 write_date(0x30+ge); //送去液晶显示个位
101 1 }
102
103 void write_weekDay(uchar add,uchar date)//写时分秒函数
104 {
105 1 write_com(0x80+add);//设置显示位置
106 1 for(number=0;number<3;number++)
107 1 {
108 2 write_date(weekTable[date][number]);//送去液晶显示十位
109 2 delay(2);
110 2 }
111 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 257 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
C51 COMPILER V9.00 LCD 10/29/2012 15:18:33 PAGE 3
PDATA SIZE = ---- ----
DATA SIZE = 1 ----
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 + -