📄 dtt-110.lst
字号:
C51 COMPILER V7.50 DTT_110 06/29/2005 09:27:32 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE DTT_110
OBJECT MODULE PLACED IN DTT-110.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE DTT-110.C BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg52.h>
2 #include <stdio.h>
3 #include <INTRINS.H>
4
5 #define Uchar unsigned char
6 #define Uint unsigned int
7
8 Uint Getkey(Uint d,r);
9 void print(Uint i);
10 void Readset(void);
11 void Saveset(void);
12
13 sbit I_O = P3^6;
14
15 bit Discmd;
16 bit Clock;
17 bit CHK_SIGN;
18 bit DMX_SIGN;
19 bit Wr;
20 bit Pclock;
21 bit Fclock;
22 bit Tclock;
23
24 Uchar disclk;
25 Uchar Mode ;
26 Uchar Menu1;
27 Uchar Menu2;
28 Uchar Display;
29 Uint ADDR_CON;
30 Uint Dmxaddr;
31 Uchar Power ;
32 Uchar M_s_com;
33 Uchar RECDAT;
34 Uchar Dconter;
35 Uchar dmxdat[5];
36 Uchar Dmxmode;
37 Uchar Year;
38 Uchar Month;
39 Uchar Day;
40 Uchar idata Timer[24];
41 Uchar Program;
42 Uint Speed;
43 Uchar Fadetime;
44 Uchar Conter1;
45 Uint Conter2;
46 Uchar Conter3;
47 Uchar out[3];
48 Uchar pwm;
49 Uchar ad;
50 Uchar Step;
51 Uchar Maxout;
52 Uint Uspeed;
53 Uchar bdata flag;
54 Uchar buf[4];
55
C51 COMPILER V7.50 DTT_110 06/29/2005 09:27:32 PAGE 2
56 sfr WDT = 0xa6;
57 sbit T1_ON = flag^0;
58 sbit T1_OFF = flag^1;
59 sbit T2_ON = flag^2;
60 sbit T2_OFF = flag^3;
61 sbit T3_ON = flag^4;
62 sbit T3_OFF = flag^5;
63 sbit T4_ON = flag^6;
64 sbit T4_OFF = flag^7;
65
66 #include <lcd1602.c>
67 #include <scan_key.c>
68 #include <ds1302.c>
69 #include <DS18B20.C>
70 #include <AT24C02.C>
71
72 void Dmxout(void){unsigned char i;
73 1 for(i=0;i<=100;i++)TXD=0;
74 1 for(i=0;i<=10;i++)TXD=1;
75 1 TB8=1;
76 1 SBUF=0x55;
77 1 while(TI!=1);TI=0;
78 1 for(i=0;i<5;i++){SBUF=dmxdat[i];while(TI!=1);TI=0;}
79 1 }
80
81
82 void int0() interrupt 0 using 2 {
83 1 SCAN_KEY();
84 1 pwm = 0;
85 1 Fclock = 1;
86 1 if(Mode >= 2){Dmxout();}
87 1 if(key_read != 0){Display = 0;Conter1 = 0;}
88 1 disclk++;
89 1 if(disclk>=100){
90 2 disclk = 0;
91 2 Tclock = 1;
92 2 Clock = 1;
93 2 if(Conter2 >= Uspeed){
94 3 Pclock = 1;
95 3 Conter2 = 0;
96 3 goto nnn;
97 3 }
98 2 Conter2++;
99 2 nnn: Conter1++;
100 2 if(Conter1==10) {
101 3 Conter1 = 0;
102 3 Display++;
103 3 if(Display > 2)
104 3 Display = 1;
105 3 }
106 2
107 2 }
108 1 if(Dconter == 0) { P3_7 = 0;return;}
109 1 Dconter--;
110 1 Conter3++;
111 1 if(Conter3 == 5){P3_7 = ~P3_7;Conter3 = 0;}
112 1 }
113 void time1() interrupt 3 using 2{
114 1 pwm--;
115 1 ACC=pwm-out[0];CY = ~CY; P2_5 = CY;
116 1 ACC=pwm-out[1];CY = ~CY; P2_6 = CY;
117 1 ACC=pwm-out[2];CY = ~CY; P2_7 = CY;
C51 COMPILER V7.50 DTT_110 06/29/2005 09:27:32 PAGE 3
118 1 WDT = 0x1e;
119 1 WDT = 0xe1;
120 1 }
121
122 Uint Getkey(Uint d,r) {
123 1 if(key_u==1) {key_u = 0; Discmd = 1; Wr = 1; if(d>=r)d=0xffff;d++;}
124 1 if(key_d==1) {key_d = 0; Discmd = 1; Wr = 1; if(d==0)d=r+1;d--;}
125 1 return(d);
126 1 }
127
128 void print(Uint i){
129 1 Uchar buf [3];
130 1 Uchar b;
131 1
132 1 sprintf(buf,"%u % u % u",i);
133 1 for(b=0; b<3; b++)DispOneChar(12+b,0,buf[b]);
134 1 }
135
136 void pprint(Uchar x,y, Uchar i) {
137 1 Uchar buf[2];
138 1
139 1 buf[0] = i >> 4 & 0x0f;
140 1 buf[1] = i & 0xf;
141 1 DispOneChar(x,y,buf[0]+0x30);
142 1 DispOneChar(x+1,y,buf[1]+0x30);
143 1 }
144 void displaydate() {
145 1 Uchar buf[7];
146 1 float tt ;
147 1 Uint t;
148 1
149 1 if(Clock==1){
150 2 Clock = 0;
151 2 reset_3w();
152 2 wbyte_3w(0xbf); //以多字节突发方式读取时钟数据
153 2 buf[0] = rbyte_3w(); //秒
154 2 buf[1] = rbyte_3w(); //分
155 2 buf[2] = rbyte_3w(); //小时
156 2 buf[3] = rbyte_3w(); //日期
157 2 buf[4] = rbyte_3w(); //月份
158 2 buf[5] = rbyte_3w(); //星期
159 2 buf[6] = rbyte_3w(); //年
160 2 reset_3w();
161 2
162 2 ePutstr(0,0,"20 - - W ");
163 2 ePutstr(0,1," : : ");
164 2 pprint(2,0,buf[6]);
165 2 pprint(5,0,buf[4]);
166 2 pprint(8,0,buf[3]);
167 2 pprint(13,0,buf[5]);
168 2 pprint(0,1,buf[2]);
169 2 pprint(3,1,buf[1]);
170 2 pprint(6,1,buf[0]);
171 2 t=Readtemp();
172 2 if(t & 0x8000 == 1) {t = ~t;tt = -t*0.0625;goto dist;}
173 2 tt= t*0.0625;
174 2 dist: sprintf(buf,"%fu",tt);
175 2 buf[6] = 11;
176 2 for(buf[5] = 0; buf[5] < 5; buf[5]++)DispOneChar(buf[6]+buf[5],1,buf[buf[5]]);
177 2 }
178 1 }
179
C51 COMPILER V7.50 DTT_110 06/29/2005 09:27:32 PAGE 4
180 void PDisplay(void) {
181 1 if (Display == 1)
182 1 displaydate();
183 1 if (Display == 2) {
184 2 if(Clock==1){
185 3 Clock = 0;
186 3 if(Mode == 0) ePutstr(0,0,"Mode: DMX In ");
187 3 if(Mode == 1) ePutstr(0,0,"Mode: Slave ");
188 3 if(Mode == 2) ePutstr(0,0,"Mode: Master ");
189 3 if(Mode == 3) ePutstr(0,0,"Mode: Timers ");
190 3 if(ad==0){ad=1;ePutstr(0,1,"Jin Yi Lighting ");return;}
191 3 if(ad==1){ad=2;ePutstr(0,1,"Zhe Jiang Nin Bo");return;}
192 3 if(ad==2){ad=0;ePutstr(0,1,"TEL:057488005512");return;}
193 3 }
194 2 }
195 1 }
196
197 Uchar code Password1[]= {7,6,0,7,2,1,};
198 Uchar code Password2[]= {8,2,0,4,0,8,};
199 Uchar code Password3[]= {0,4,0,5,1,0,};
200
201 void Timerset() {
202 1 Uchar menu = 0 ;
203 1 Uchar tm = 0 ;
204 1 Uchar r;
205 1 while(1){
206 2 if(key_e == 1){
207 3 key_e = 0;
208 3 Discmd=1;
209 3 if (tm >=2 ){tm=0xff;if(menu>=7)menu=0xff;menu++;}tm++;
210 3 }
211 2 if(key_c == 1){key_c = 0; Menu2 = 0; Discmd=1; return;}
212 2 r = Timer[menu*3+tm];
213 2 if (tm == 0)r = Getkey(r,23);
214 2 if (tm == 1)r = Getkey(r,59);
215 2 if (tm == 2)r = Getkey(r,2);
216 2 Timer[menu*3+tm] = r;
217 2 if (Discmd==1){
218 3 Uchar a,b;
219 3
220 3 Discmd =0;
221 3 ePutstr(0,1,"Set ON/OFF Time ");
222 3 ePutstr(0,0,"T : : S: ");
223 3 DispOneChar(1,0,menu+0x31);
224 3 a = Timer[menu*3+0]/10;
225 3 b = Timer[menu*3+0]%10;
226 3 DispOneChar(3,0,a+0x30);
227 3 DispOneChar(4,0,b+0x30);
228 3 a = Timer[menu*3+1]/10;
229 3 b = Timer[menu*3+1]%10;
230 3 DispOneChar(6,0,a+0x30);
231 3 DispOneChar(7,0,b+0x30);
232 3 if(Timer[menu*3+2]==0)ePutstr(12,0,"NULL");
233 3 if(Timer[menu*3+2]==1)ePutstr(12,0,"ON ");
234 3 if(Timer[menu*3+2]==2)ePutstr(12,0,"OFF ");
235 3 if(tm == 0)Coruscant(4,0);
236 3 if(tm == 1)Coruscant(7,0);
237 3 if(tm == 2)Coruscant(15,0);
238 3 }
239 2 }
240 1 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -