📄 matrix.lst
字号:
C51 COMPILER V8.08 MATRIX 03/10/2009 15:02:49 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE MATRIX
OBJECT MODULE PLACED IN Matrix.OBJ
COMPILER INVOKED BY: D:\软件\单片机\proteus7.1+keil8.08\Keil8.08\C51\BIN\C51.EXE Matrix.c LARGE BROWSE DEBUG OBJECTEXTEN
-D
line level source
1 //========================================================================================
2 // 程序功能: 将DS1302的时间装配到显存
3 // 将显存中的内容显示到点阵
4 // 程序接口: void Time_ValueToASCII();
5 // void Matrix_Dis();
6 // 编写时间: 2009-03-02
7 //========================================================================================
8
9 #include<Module.h>
10 #include<AsciiTab.h>
11
12 extern bit G_b500mS;
13 extern unsigned char G_ucTime[];
14
15 #define P4 0x0e8
16
17 sbit scl=P3^7; //脉冲
18 sbit stb=P4^0; //显示 74hc595
19 sbit sda=P4^1; //数据
20
21 unsigned char code up[]={0xf7,0xfb,0xfd,0xfe,0x7f,0xbf,0xdf,0xef};
22 unsigned char code down[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
23 unsigned char G_ucDiszone[]="10:10:10";
24
25 //========================================================================================
26 // 函数功能: 将DS1302的时间装配到显存
27 // 函数接口: void Time_ValueToASCII();
28 // 入口参数: extern unsigned char G_ucTime[]
29 // 出口参数: unsigned char G_ucDiszone[]
30 // 备 注:运算指令的优先级别 如:+优先于>>
31 //========================================================================================
32 void Time_ValueToASCII()
33 {
34 1 static uc ucPreSecond=10;
35 1
36 1 G_ucDiszone[0]=((G_ucTime[2]&0xf0) >> 4)+'0';//时
37 1 G_ucDiszone[1]=(G_ucTime[2]&0x0f)+'0';
38 1 G_ucDiszone[2]=':';
39 1 G_ucDiszone[3]=((G_ucTime[1]&0xf0) >> 4)+'0';//分
40 1 G_ucDiszone[4]=(G_ucTime[1]&0x0f)+'0';
41 1
42 1 //if(G_ucDiszone[7]%2==0) G_ucDiszone[5]=10+'0';
43 1 //else G_ucDiszone[5]=17+'0';
44 1
45 1 G_ucDiszone[6]=((G_ucTime[0]&0xf0) >> 4)+'0';//秒
46 1 G_ucDiszone[7]=(G_ucTime[0]&0x0f)+'0';
47 1
48 1 if((G_ucTime[0]!=ucPreSecond)&&(TR0==0) ) //':’以500的时间闪烁
49 1 {
50 2 TR0=1;
51 2 G_b500mS=0;
52 2 }//if
53 1 if( G_b500mS==0 )
54 1 {
C51 COMPILER V8.08 MATRIX 03/10/2009 15:02:49 PAGE 2
55 2 G_ucDiszone[5]=':';
56 2 }//if
57 1 else
58 1 {
59 2 TR0=0;
60 2 G_ucDiszone[5]=' ';
61 2 ucPreSecond=G_ucTime[0];
62 2 }//else
63 1 }
64 //========================================================================================
65 // 函数功能: 将数据串行输出
66 // 函数接口: void Matrix_Send1Row();
67 // 出口参数: unsigned char sda
68 //========================================================================================
69 void Matrix_Send1Row(uc temp)
70 {
71 1 uc i;
72 1
73 1 scl=0;
74 1 for(i=0;i<8;i++)
75 1 {
76 2 scl=0;
77 2 temp=temp<<1;
78 2 sda=CY;
79 2 scl=1;
80 2 }//for
81 1 }
82 //========================================================================================
83 // 函数功能: 输出一行显示
84 // 函数接口: void Matrix_Output1Row();
85 //========================================================================================
86 void Matrix_Output1Row()
87 {
88 1 stb=0;
89 1 stb=1;
90 1 }
91 //========================================================================================
92 // 函数功能: 点阵显示屏行使能
93 // 函数接口: void Matrix_En1RowCom(uc ucRow);
94 //========================================================================================
95 void Matrix_En1RowCom(uc ucRow)
96 {
97 1 if( ucRow<8 ) //行扫描
98 1 {
99 2 P2=0xff;
100 2 P0=up[ucRow];
101 2 }//if
102 1 else
103 1 {
104 2 P0=0xff;
105 2 P2=down[ucRow-8];
106 2 }//else
107 1 }
108 //========================================================================================
109 // 函数功能: 清屏
110 // 函数接口: Matrix_Dis1RowCom();
111 //========================================================================================
112 Matrix_Dis1RowCom()
113 {
114 1 P0=0xff; //屏蔽点阵屏
115 1 P2=0xff;
116 1 }
C51 COMPILER V8.08 MATRIX 03/10/2009 15:02:49 PAGE 3
117 //========================================================================================
118 // 函数功能: 延时
119 // 函数接口: void Matrix_DisDelay(uc z);
120 //========================================================================================
121 void Matrix_DisDelay(uc z) //延时子程序
122 {
123 1 uc x,y;
124 1
125 1 for(x=z;x>0;x--)
126 1 for(y=5;y>0;y--);
127 1 }
128 //========================================================================================
129 // 函数功能: 点阵显示
130 // 函数接口: void Matrix_Dis();
131 // 入口参数: unsigned char tab[((G_ucDiszone[cCharIndex]-'0')<<4)+ucRow];
132 // 出口参数: unsigned char Matrix_Send1Row(tab[((G_ucDiszone[cCharIndex]-'0')<<4)+ucRow]);
133 //========================================================================================
134 void Matrix_Dis()
135 {
136 1 uc ucRow;
137 1 char cCharIndex;
138 1
139 1 for(ucRow=0;ucRow<16;ucRow++)
140 1 {
141 2 for(cCharIndex=7;cCharIndex>=0;cCharIndex--)
142 2 {
143 3 if( G_ucDiszone[cCharIndex]==' ')
144 3 Matrix_Send1Row(tab[16*16+ucRow]);
145 3 else
146 3 Matrix_Send1Row(tab[((G_ucDiszone[cCharIndex]-'0')<<4)+ucRow]);
147 3 }//for
148 2 Matrix_Output1Row();
149 2 Matrix_En1RowCom(ucRow);
150 2 Matrix_DisDelay(10);
151 2 Matrix_Dis1RowCom();
152 2 }//for
153 1 //while(1);
154 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 317 ----
CONSTANT SIZE = 288 ----
XDATA SIZE = 10 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
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 + -