📄 timer.lst
字号:
C51 COMPILER V7.50 TIMER 03/30/2006 19:28:31 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE TIMER
OBJECT MODULE PLACED IN Timer.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE Timer.c ROM(COMPACT) DEBUG OBJECTEXTEND
line level source
1 #include<reg52.h>
2 #include<ee.h>
3 #include<eprom.h>
4 #include<lcdfuncs.h>
5
6 sbit relay1=P3^1;
7 sbit relay2=P3^5;
8 sbit relay3=P3^6;
9 //sbit relay4=P3^7;
10 sbit i1=P1^5;
11 sbit i2=P1^6;
12 sbit i3=P1^4;
13
14 char char_sel=1,screen_no,ccc1,ccc2,ccc3;
15
16 unsigned int on_time_rl1,on_time_rl2,on_time_rl3;
17 unsigned int off_time_rl1,off_time_rl2,off_time_rl3;
18 unsigned int t_i1_on=0,t_i2_on=0,t_i3_on=0;
19 unsigned int t_i1_off=0,t_i2_off=0,t_i3_off=0;
20 char on_time1_rl1,on_time2_rl1,on_time3_rl1;
21 char on_time1_rl2,on_time2_rl2,on_time3_rl2;
22 char on_time1_rl3,on_time2_rl3,on_time3_rl3;
23 char off_time1_rl1,off_time2_rl1,off_time3_rl1;
24 char off_time1_rl2,off_time2_rl2,off_time3_rl2;
25 char off_time1_rl3,off_time2_rl3,off_time3_rl3;
26 bit in_1_on_flag=0,in_2_on_flag=0,in_3_on_flag=0;
27 bit in_1_off_flag=0,in_2_off_flag=0,in_3_off_flag=0;
28
29 int k;
30 unsigned int temp_time=0;
31
32 char *x;
33 key_pressed();
34
35 void delay(unsigned int del)
36 {
37 1 unsigned long int j;
38 1 for(j=0;j<del*2;j++);
39 1 }
40 display_count (unsigned char c3,unsigned char c2,unsigned char c1)
41 {
42 1 write_LCD_byte(LCD_CONTROL,LINE_2 + 8);
43 1 write_LCD_byte(LCD_DATA,c3 + 0x30);
44 1 write_LCD_byte(LCD_CONTROL,LINE_2 + 9);
45 1 write_LCD_byte(LCD_DATA,'.');
46 1 write_LCD_byte(LCD_CONTROL,LINE_2 + 10);
47 1 write_LCD_byte(LCD_DATA,c2 + 0x30);
48 1 write_LCD_byte(LCD_CONTROL,LINE_2 + 11);
49 1 write_LCD_byte(LCD_DATA,c1 + 0x30);
50 1 write_LCD_byte(LCD_CONTROL,LINE_2 + 13);
51 1 write_LCD_byte(LCD_DATA,'S');
52 1 write_LCD_byte(LCD_CONTROL,LINE_2 + 14);
53 1 write_LCD_byte(LCD_DATA,'e');
54 1 write_LCD_byte(LCD_CONTROL,LINE_2 + 15);
55 1 write_LCD_byte(LCD_DATA,'c');
C51 COMPILER V7.50 TIMER 03/30/2006 19:28:31 PAGE 2
56 1 switch(char_sel)
57 1 {
58 2 case 1: write_LCD_byte(LCD_CONTROL,0x0E);
59 2 write_LCD_byte(LCD_CONTROL,LINE_2 + 11);
60 2 break;
61 2 case 2: write_LCD_byte(LCD_CONTROL,0x0E);
62 2 write_LCD_byte(LCD_CONTROL,LINE_2 + 10);
63 2 break;
64 2 case 3: write_LCD_byte(LCD_CONTROL,0x0E);
65 2 write_LCD_byte(LCD_CONTROL,LINE_2 + 8);
66 2 break;
67 2 default: write_LCD_byte(LCD_CONTROL,0x0C);
68 2 break;
69 2 }
70 1 }
71
72 main()
73 {
74 1 delay(100);
75 1 // P0=0xff;
76 1 P2=0XFF;
77 1 P1=0xff;
78 1 P3=0xff;
79 1 SP=0x7f;
80 1 TL1=0x2f;
81 1 TH1=0xf8;
82 1 TMOD=(TMOD & 0x0f) | 0x10;
83 1 ET1=1;
84 1 IT1=1;
85 1 EA=1;
86 1 WP=0;
87 1 sda=1;
88 1 scl=1;
89 1 delay(100);
90 1 init_2_line_LCD();
91 1 delay(10);
92 1 ee_byte_from_ee(0x0b,&on_time1_rl1);delay(10);
93 1 ee_byte_from_ee(0x1b,&on_time2_rl1);delay(10);
94 1 ee_byte_from_ee(0x2b,&on_time3_rl1);delay(10);
95 1 ee_byte_from_ee(0x4b,&on_time1_rl2);delay(10);
96 1 ee_byte_from_ee(0x5b,&on_time2_rl2);delay(10);
97 1 ee_byte_from_ee(0x6b,&on_time3_rl2);delay(10);
98 1 ee_byte_from_ee(0x7b,&on_time1_rl3);delay(10);
99 1 ee_byte_from_ee(0x8b,&on_time2_rl3);delay(10);
100 1 ee_byte_from_ee(0x9b,&on_time3_rl3);delay(10);
101 1 ee_byte_from_ee(0xab,&off_time1_rl1);delay(10);
102 1 ee_byte_from_ee(0xbb,&off_time2_rl1);delay(10);
103 1 ee_byte_from_ee(0xcb,&off_time3_rl1);delay(10);
104 1 ee_byte_from_ee(0xdb,&off_time1_rl2);delay(10);
105 1 ee_byte_from_ee(0xeb,&off_time2_rl2);delay(10);
106 1 ee_byte_from_ee(0x43,&off_time3_rl2);delay(10);
107 1 ee_byte_from_ee(0x53,&off_time1_rl3);delay(10);
108 1 ee_byte_from_ee(0x63,&off_time2_rl3);delay(10);
109 1 ee_byte_from_ee(0x73,&off_time3_rl3);delay(10);
110 1 on_time_rl1=on_time1_rl1+(10*on_time2_rl1)+(100*on_time3_rl1);
111 1 on_time_rl2=on_time1_rl2+(10*on_time2_rl2)+(100*on_time3_rl2);
112 1 on_time_rl3=on_time1_rl3+(10*on_time2_rl3)+(100*on_time3_rl3);
113 1 off_time_rl1=off_time1_rl1+(10*off_time2_rl1)+(100*off_time3_rl1);
114 1 off_time_rl1=off_time1_rl2+(10*off_time2_rl2)+(100*off_time3_rl2);
115 1 off_time_rl1=off_time1_rl3+(10*off_time2_rl3)+(100*off_time3_rl3);
116 1 delay(10);
117 1 screen_no=0;
C51 COMPILER V7.50 TIMER 03/30/2006 19:28:31 PAGE 3
118 1 clear_lcd();
119 1 write_LCD_line(LINE_1+2,"WELCOME TO");
120 1 write_LCD_line(LINE_2+4,"ALLIED ENGG.");
121 1 delay(150);
122 1 TR1=1;
123 1
124 1 while(1)
125 1 {
126 2 if(i1==0 & relay1==1 & relay2==1 & relay3==1) in_1_on_flag=1; else in_1_on_flag=0;
127 2 if(i2==0 & relay1==1 & relay2==1 & relay3==1) in_2_on_flag=1; else in_2_on_flag=0;
128 2 if(i3==0 & relay1==1 & relay2==1 & relay3==1) in_3_on_flag=1; else in_3_on_flag=0;
129 2 if(i1==1)
130 2 {
131 3 in_1_off_flag=1;
132 3 in_1_on_flag=0;
133 3 t_i1_on=0;
134 3 } else{ in_1_off_flag=0; t_i1_off=0; }
135 2 if(i2==1)
136 2 {
137 3 in_2_off_flag=1;
138 3 in_2_on_flag=0;
139 3 t_i2_on=0;
140 3 } else{ in_2_off_flag=0; t_i2_off=0;}
141 2 if(i3==1)
142 2 {
143 3 in_3_off_flag=1;
144 3 in_3_on_flag=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -