📄 clock.lst
字号:
58 =1 //#define V_TH1 0xb8//20ms
59 =1 //#define V_TL1 0x00
60 =1 #define V_TH1 0xdc //10ms
61 =1 #define V_TL1 0x00
62 =1 #define V_TH2 0xff //9600 bps
63 =1 #define V_TL2 0xdb
64 =1 //#define SEC 50
65 =1 #define SEC 100
66 =1 #define N 1
67 =1
68 =1 #define LIGHT P3_7
69 =1 #define AC_DECT P1_2
70 =1 #define BAT_DECT P3_3
71 =1 #define FALSE 0
72 =1 #define TRUE 1
73 =1 #define PAND 0
74 =1 #define FOOKTIN 1
75 =1 #define LCD_MODE 0x08 //display(1:4,1/3)
76 =1 #define LCD_GLITTER 0x00 //off
C51 COMPILER V7.50 CLOCK 05/27/2006 14:01:02 PAGE 6
77 =1 #define MAX_RECORD 0xbb8 //3000
78 =1 #define PLU_LEN 22
79 =1 #define TABLE_LEN 64
80 =1 #define RECORD_LEN 15
81 =1 /**********mode**********/
82 =1 #define Input_code_mode 1
83 =1 #define Calibration_mode 2
84 =1 #define Initialization_mode 3
85 =1 #define Sales_mode 4
86 =1 #define Total_mode 5
87 =1 #define Payback_mode 6
88 =1 #define PLU_Setup_mode 7
89 =1 #define Time_Setup_mode 8
90 =1 #define Beep_and_Light_Setup_mode 9
91 =1 #define Calculator_mode 10
92 =1 #define Reports_mode 11
93 =1 #define Download_mode 12
94 =1 #define Power_down_mode 13
95 =1 #define Print_Cancel_mode 14
96 =1 /**********state**********/
97 =1 #define WEIGHING 1
98 =1 #define NON_WEIGHING 2
99 =1 #define PAYBACK 3
100 =1
101 =1 #define PLU_EDIT 1
102 =1 #define PLU_SAVE 2
103 =1
104 =1 #define SET_BEEP 1
105 =1 #define SET_LIGHT 2
106 =1
107 =1 #define MENU_1 1
108 =1 #define MENU_1_1 11
109 =1 #define MENU_1_2 12
110 =1 #define MENU_1_2_1 121
111 =1 #define MENU_1_2_2 122
112 =1 #define MENU_1_2_2_0 1221
113 =1 #define MENU_1_3 13
114 =1 #define MENU_1_4 14
115 =1
116 =1 #define MENU_2 2
117 =1 #define MENU_2_1 21
118 =1 #define MENU_2_2 22
119 =1 #define MENU_2_2_1 221
120 =1 #define MENU_2_2_2 222
121 =1 #define MENU_2_2_2_0 2221
122 =1 #define MENU_2_3 23
123 =1
124 =1 #define MENU_3 3
125 =1 #define MENU_3_1 31
126 =1 #define MENU_3_2 32
127 =1 #define MENU_3_2_1 321
128 =1 #define MENU_3_2_2 322
129 =1 #define MENU_3_2_2_0 3221
130 =1 #define MENU_3_3 33
131 =1
132 =1 #define EDIT_YEAR 1
133 =1 #define EDIT_MONTH 2
134 =1 #define EDIT_DAY 3
135 =1 #define EDIT_HOUR 4
136 =1 #define EDIT_MINUTE 5
137 =1 #define EDIT_SECOND 6
138 =1
C51 COMPILER V7.50 CLOCK 05/27/2006 14:01:02 PAGE 7
139 =1 /**********sales type**********/
140 =1 #define PW 1
141 =1 #define PN 2
142 =1 #define MW 3
143 =1 #define MN 4
144 =1 #define DELE 0xaa
145 =1
146 =1 /**********print type***********/
147 =1 #define PW 1
148 =1 #define PN 2
149 =1 #define MW 3
150 =1 #define MN 4
151 =1 #define TOTAL 5
152 =1
153 =1 /**********report type**********/
154 =1 #define TOTAL_ALL_MONEY 1
155 =1 #define TOTAL_ALL_PLU_MONEY 2
156 =1 #define TOTAL_SEL_PLU_MONEY 3
157 =1 #define TOTAL_ALL_MANUL_MONEY 4
158 =1 #define TOTAL_ALL_NUMBER_MONEY 5
159 =1 #define TOTAL_ALL_WEIGHT 6
160 =1 #define TOTAL_ALL_PLU_WEIGHT 7
161 =1 #define TOTAL_SEL_PLU_WEIGHT 8
162 =1 #define TOTAL_ALL_MANUL_WEIGHT 9
163 =1 #define TOTAL_ALL_NUMBER 10
164 =1 #define TOTAL_ALL_PLU_NUMBER 11
165 =1 #define TOTAL_SEL_PLU_NUMBER 12
166 =1 #define TOTAL_ALL_MANUL_NUMBER 13
167 =1
168 =1 /********operate status********/
169 =1 #define ADD 1
170 =1 #define SUM 2
171 =1 #define PAY 3
172 =1
173 =1 /********eeprom address********/
174 =1 #define EEPROM_ID 0
175 =1 #define Option_Param_address 2
176 =1 #define Graduation_Grade_address 3
177 =1 #define Graduation1_address 5
178 =1 #define Graduation2_address 6
179 =1 #define Max_Capacity_address 7
180 =1 #define Initial_Zero_Setting_limit_address 9
181 =1 #define Zero_Setting_and_Zero_Tracking_limit_address 10
182 =1 #define Zero_Stable_count_address 11
183 =1 #define Zero_Stable_times_address 13
184 =1 #define Weight_Stable_count_address 14
185 =1 #define Weight_Stable_times_address 16
186 =1 #define Err1_Timeout_address 17
187 =1 #define Local_Height_address 18
188 =1 #define Local_Latitude_address 20
189 =1 #define Destination_Height_address 21
190 =1 #define Destination_Latitude_address 23
191 =1 #define Soft_Ver_address 24
192 =1 #define Cal_counts_address 26
193 =1 #define Password_address 27
194 =1 #define Cal_Zero_limit_count_address 30
195 =1 #define Cal_One_count_address 36
196 =1 #define Cal_Zero_count_address 40
197 =1 #define Cal_Weight_count_address 44
198 =1 #define Logo_address 48
199 =1 #define PLU_DATA_ADR 0x40
200 =1 #define RECORD_DATA_ADR 0x2600
C51 COMPILER V7.50 CLOCK 05/27/2006 14:01:02 PAGE 8
201 =1
202 =1 /********report save address********/
203 =1 #define PLU_no_Save_address 1
204 =1 #define Unit_Price_Save_address 3
205 =1 #define Weight_Save_address 6
206 =1 #define Quantity_Save_address 6
207 =1 #define Total_Price_Save_address 9
8 #define HALF_SEC 10
9
10 static BYTE const days_month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
11 extern BOOL half_sec,One_sec,colon;
12 extern TIME time;
13 extern DATE date;
14 extern BYTE lcd2_buf[7];
15 extern BYTE lcd3_buf[7];
16 extern BYTE state;
17
18 extern VOID Alarm();
19
20 BOOL leap_year()
21 {
22 1 if(date.year%4==0)
23 1 return TRUE;
24 1 else
25 1 return FALSE;
26 1 }
27
28 BOOL Clock_Set_Save()
29 {
30 1 BYTE lyear,lmonth,lday;
31 1 BYTE lhour,lmin,lsec;
32 1 lyear=(lcd3_buf[5]-'0')*10+(lcd3_buf[4]-'0');
33 1 lmonth=(lcd3_buf[3]-'0')*10+(lcd3_buf[2]-'0');
34 1 lday=(lcd3_buf[1]-'0')*10+(lcd3_buf[0]-'0');
35 1 lhour=(lcd2_buf[5]-'0')*10+(lcd2_buf[4]-'0');
36 1 lmin=(lcd2_buf[3]-'0')*10+(lcd2_buf[2]-'0');
37 1 lsec=(lcd2_buf[1]-'0')*10+(lcd2_buf[0]-'0');
38 1 switch(state)
39 1 {
40 2 case EDIT_MONTH:
41 2 if(lmonth<1||lmonth>12)
42 2 {
43 3 Alarm();
44 3 return FALSE;
45 3 }
46 2 if(lmonth==2&&leap_year())
47 2 {
48 3 if(lday<1||lday>29)
49 3 lday=29;
50 3 }
51 2 else if(!leap_year()&&(lday<1||lday>days_month[lmonth]))
52 2 lday=days_month[lmonth];
53 2 break;
54 2 case EDIT_DAY:
55 2 if(lmonth==2&&leap_year())
56 2 {
57 3 if(lday<1||lday>29)
58 3 {
59 4 Alarm();
60 4 return FALSE;
61 4 }
62 3 }
C51 COMPILER V7.50 CLOCK 05/27/2006 14:01:02 PAGE 9
63 2 else if(!leap_year()&&(lday<1||lday>days_month[lmonth]))
64 2 {
65 3 Alarm();
66 3 return FALSE;
67 3 }
68 2 break;
69 2 case EDIT_HOUR:
70 2 if(lhour>23)
71 2 {
72 3 Alarm();
73 3 return FALSE;
74 3 }
75 2 break;
76 2 case EDIT_MINUTE:
77 2 if(lmin>59)
78 2 {
79 3 Alarm();
80 3 return FALSE;
81 3 }
82 2 break;
83 2 case EDIT_SECOND:
84 2 if(lsec>59)
85 2 {
86 3 Alarm();
87 3 return FALSE;
88 3 }
89 2 break;
90 2 }
91 1 TR0=0;
92 1 date.year=lyear;
93 1 date.month=lmonth;
94 1 date.day=lday;
95 1 time.hour=lhour;
96 1 time.min=lmin;
97 1 time.sec=lsec;
98 1 TH0=V_TH0,TL0=V_TL0;
99 1 TR0=1;
100 1 return TRUE;
101 1 }
102
103 VOID timer0()interrupt 1 using 1
104 {
105 1 static BYTE data click=0;
106 1 EA=0;
107 1 TL0=V_TL0;
108 1 TH0=V_TH0;
109 1 ++click;
110 1 if(click>=HALF_SEC)
111 1 {
112 2 click=0;
113 2 half_sec=TRUE;
114 2 colon=~colon;
115 2 if(colon)
116 2 {
117 3 One_sec=TRUE;
118 3 if(++time.sec>=60)
119 3 {
120 4 time.sec=0;
121 4 if(++time.min>=60)
122 4 {
123 5 time.min=0;
124 5 if(++time.hour>=24)
C51 COMPILER V7.50 CLOCK 05/27/2006 14:01:02 PAGE 10
125 5 {
126 6 time.hour=0;
127 6 if(++date.day>days_month[date.month])
128 6 {
129 7 if(date.month==2&&leap_year())
130 7 {
131 8 if(date.day>29)
132 8 date.day=1;
133 8 }
134 7 else
135 7 date.day=1;
136 7 if(++date.month>12)
137 7 {
138 8 date.month=1;
139 8 if(++date.year>=99)
140 8 date.year=0;
141 8 }
142 7 }
143 6 }
144 5 }
145 4 }
146 3 }
147 2 }
148 1 EA=1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -