📄 set.lst
字号:
C51 COMPILER V7.08 SET 03/05/2007 16:38:10 PAGE 1
C51 COMPILER V7.08, COMPILATION OF MODULE SET
OBJECT MODULE PLACED IN set.OBJ
COMPILER INVOKED BY: D:\程序\keil c\C51\BIN\C51.EXE set.c LARGE INCDIR(c:|keil) DEBUG OBJECTEXTEND
line level source
1 #include <intrins.h>
2 #include <24C02.h>
3 #include <lcd128x64.h>
4 #include <keyboard451.h>
5 #include <print.h>
6 #include <set.h>
7
8
9
10 //根据数字去查找每个位数的地址,在液晶那边为每个位设置了一个地址变量,液晶根据这些变量来显示
11 WORD save_current_num = 0;
12
13 BYTE save_current_type = 0; //类别
14
15 BYTE save_tem_type = 0;
16
17 long int save_current_pizhong = 0;
18
19 long int save_tem_pizhong = 0;
20
21 //直接地址操作,不需要经过从数字到地址的转换。
22 WORD save_current_usename[5] = {0xA1A0,0xA1A0,0xA1A0,0xA1A0,0xA1A0};
23 WORD save_tem_usename[5] = {0xA1A0,0xA1A0,0xA1A0,0xA1A0,0xA1A0};
24
25 set_struct1 set_usename_struct = {
26 &save_tem_usename,
27 0,
28 0
29 };
30
31 set_struct set_type_struct = {
32 &save_tem_type,
33 0
34 };
35
36 set_struct set_pizhong_struct = {
37 &save_tem_pizhong,
38 0
39 };
40
41 static void set_current_usename_word_bykey(BYTE word_num, WORD num);
42
43 /************************************************/
44 /*void set_type_num_address_bydata(BYTE data100)
45 /*hl//061117将三位的数据data100化成百位、十位、个位三个数字
46 /*save_type_buffer.baiwei、save_type_buffer.shiwei、save_type_buffer.gewei
47 /*****************************************************/
48 void set_type_num_address_bydata(BYTE data100)
49 {
50 1 BYTE tem_1,tem_2;
51 1
52 1 tem_1 = data100 / 100;
53 1 tem_2 = data100 - tem_1 * 100;
54 1 save_type_buffer.baiwei = 0x30 + tem_1;
55 1 save_type_buffer.shiwei = 0x30 + tem_2/10;
C51 COMPILER V7.08 SET 03/05/2007 16:38:10 PAGE 2
56 1 save_type_buffer.gewei = 0x30 + (data100 - tem_1 * 100 - (tem_2/10) * 10);
57 1 }
58
59 /**********************************************************************************/
60 //void set_pizhong_num_address_bydata(long int p_data)
61 //hl//061117将七位的数据p_data化成百万位、十万位、万位、千位、百位、十位、个位七个数字
62 //save_pizhong_buffer.baiwanwei、 save_pizhong_buffer.shiwanwei、 save_pizhong_buffer.wanwei
63 //save_pizhong_buffer.qianwei、 save_pizhong_buffer.baiwei 、save_pizhong_buffer.shiwei 、 save_pizhong_b
-uffer.gewei
64 /************************************************************************************/
65 void set_pizhong_num_address_bydata(long int p_data)
66 {
67 1
68 1
69 1 WORD tem0,tem1,tem2;
70 1 BYTE tem3;
71 1 save_pizhong_buffer.baiwanwei = 0x30 +p_data/1000000; //百万位
72 1 save_pizhong_buffer.shiwanwei = 0x30 +(p_data%1000000)/100000; //十万位
73 1 tem0=(p_data%1000000)%100000; //wanqianbaishige
74 1 save_pizhong_buffer.wanwei = 0x30 +tem0/10000; //万位
75 1 tem1=tem0-(tem0/10000)*10000; //qianbaishige
76 1 save_pizhong_buffer.qianwei=0x30+tem1/1000 ; //千位
77 1 tem2=tem1-(save_pizhong_buffer.qianwei-0x30)*1000; //baishige
78 1 save_pizhong_buffer.baiwei=0x30+tem2 / 100; //百位
79 1
80 1 tem3 = tem2-( save_pizhong_buffer.baiwei-0x30)*100; //shige
81 1 save_pizhong_buffer.shiwei=0x30+tem3/10;
82 1 save_pizhong_buffer.gewei=0x30+tem3%10;
83 1 Delay1(5000);
84 1 if(save_pizhong_buffer.shiwanwei==0x30) save_pizhong_buffer.shiwanwei=0x20;
85 1 else return;
86 1 if(save_pizhong_buffer.wanwei==0x30) save_pizhong_buffer.wanwei=0x20;
87 1 else return;
88 1 if(save_pizhong_buffer.qianwei==0x30) save_pizhong_buffer.qianwei=0x20;
89 1 else return;
90 1 if(save_pizhong_buffer.baiwei==0x30) save_pizhong_buffer.baiwei=0x20;
91 1 else return;
92 1 if(save_pizhong_buffer.shiwei==0x30) save_pizhong_buffer.shiwei=0x20;
93 1 else return;
94 1
95 1 }
96 /****************************************************************/
97 //hl//设置类型值
98 //最多支持255种类型
99 /***********************************************************************/
100 void set_current_type_bykey(BYTE key_value)
101 {
102 1 BYTE num_address;
103 1
104 1 num_address = get_num_address_from_key_value(key_value);
105 1
106 1 if (num_address > 10) return; //invalid key
107 1 if (num_address == 10){ //back
108 2 if(set_type_struct.count > 0){
109 3 set_type_struct.count--;
110 3 }else{
111 3 set_type_struct.count = 0;
112 3 }
113 2 return;
114 2 }
115 1
116 1 switch (set_type_struct.count){
C51 COMPILER V7.08 SET 03/05/2007 16:38:10 PAGE 3
117 2 case 0:
118 2 if (num_address > 2) return; // >2
119 2 *(BYTE*)(set_type_struct.p_data) = (num_address * 100);
120 2 save_type_buffer.baiwei = 0x30 + num_address;
121 2 set_type_struct.count++;
122 2 break;
123 2 case 1:
124 2 *(BYTE*)(set_type_struct.p_data) += (num_address * 10);
125 2 save_type_buffer.shiwei = 0x30 + num_address;
126 2 set_type_struct.count++;
127 2 break;
128 2 case 2:
129 2 *(BYTE*)(set_type_struct.p_data) += num_address;
130 2 save_type_buffer.gewei = 0x30 + num_address;
131 2 set_type_struct.count++;
132 2 break;
133 2 default:
134 2 break;
135 2 }
136 1 }
137
138 /*****************************************************************/
139 //hl//设置皮重,最多支持999999皮重
140 /******************************************************************/
141 void set_current_pizhong_bykey(BYTE key_value)
142 {
143 1 BYTE num_address;
144 1
145 1 num_address = get_num_address_from_key_value(key_value);
146 1
147 1 if (num_address > 10) return; //invalid key
148 1 if (num_address == 10)
149 1 { //back
150 2 if(set_pizhong_struct.count > 0){
151 3 set_pizhong_struct.count--;
152 3 }else{
153 3 set_pizhong_struct.count = 0;
154 3 }
155 2 return;
156 2 }
157 1
158 1 switch (set_pizhong_struct.count){
159 2 case 0:
160 2 if (num_address > 9) return; // >2
161 2 *(long int*)(set_pizhong_struct.p_data) = (num_address * 100000);
162 2 save_pizhong_buffer.shiwanwei = 0x30 + num_address;
163 2 set_pizhong_struct.count++;
164 2 break;
165 2 case 1:
166 2 *(long int*)(set_pizhong_struct.p_data) += (num_address * 10000);
167 2 save_pizhong_buffer.wanwei = 0x30 + num_address;
168 2 set_pizhong_struct.count++;
169 2 break;
170 2 case 2:
171 2 *(long int*)(set_pizhong_struct.p_data) += (num_address * 1000);
172 2 save_pizhong_buffer.qianwei = 0x30 + num_address;
173 2 set_pizhong_struct.count++;
174 2 break;
175 2 case 3:
176 2 *(long int*)(set_pizhong_struct.p_data) += (num_address * 100);
177 2 save_pizhong_buffer.baiwei = 0x30 + num_address;
178 2 set_pizhong_struct.count++;
C51 COMPILER V7.08 SET 03/05/2007 16:38:10 PAGE 4
179 2 break;
180 2 case 4:
181 2 *(long int*)(set_pizhong_struct.p_data) += (num_address * 10);
182 2 save_pizhong_buffer.shiwei = 0x30 + num_address;
183 2 set_pizhong_struct.count++;
184 2 break;
185 2 case 5:
186 2 *(long int*)(set_pizhong_struct.p_data) += num_address;
187 2 save_pizhong_buffer.gewei = 0x30 + num_address;
188 2 set_pizhong_struct.count++;
189 2 break;
190 2
191 2 default:
192 2 break;
193 2 }
194 1 }
195
196
197 void set_current_usename_bykey(BYTE key_value)
198 {
199 1 WORD num_address;
200 1
201 1 num_address = (WORD)get_num_address_from_key_value(key_value);
202 1
203 1 if (set_usename_struct.count_word < 5)
204 1 set_current_usename_word_bykey(set_usename_struct.count_word, num_address);
205 1 else return;
206 1 }
207
208 static void set_current_usename_word_bykey(BYTE word_num, WORD num)
209 {
210 1 switch(set_usename_struct.count_bit){
211 2 case 0:
212 2 save_tem_usename[word_num] &= 0x0FFF;
213 2 save_tem_usename[word_num] |= (num << 12);
214 2 set_usename_struct.count_bit++;
215 2 break;
216 2 case 1:
217 2 save_tem_usename[word_num] &= 0xF0FF;
218 2 save_tem_usename[word_num] |= (num << 8);
219 2 set_usename_struct.count_bit++;
220 2 break;
221 2 case 2:
222 2 save_tem_usename[word_num] &= 0xFF0F;
223 2 save_tem_usename[word_num] |= (num << 4);
224 2 set_usename_struct.count_bit++;
225 2 break;
226 2 case 3:
227 2 save_tem_usename[word_num] &= 0xFFF0;
228 2 save_tem_usename[word_num] |= num;
229 2 set_usename_struct.count_bit++;
230 2 break;
231 2 default :
232 2 break;
233 2 }
234 1 }
235
236 /******************************************************************/
237 //hl//将总重的数值换算为没一位,总共有十位,从第一个不为0的数据开始显示
238 /**********************************************************************/
239 void set_zongzhong_num_address_bydata(long int p_data)
240
C51 COMPILER V7.08 SET 03/05/2007 16:38:10 PAGE 5
241 {
242 1 BYTE qian3;
243 1 long int hou7;
244 1 qian3= p_data/10000000;
245 1 hou7= p_data%10000000;
246 1 set_pizhong_num_address_bydata(hou7);
247 1 Delay1(5000);
248 1 set_type_num_address_bydata(qian3) ;
249 1 Delay1(5000);
250 1
251 1 if( save_type_buffer.baiwei ==0x30) save_type_buffer.baiwei =0x20;
252 1 else return;
253 1 if( save_type_buffer.shiwei ==0x30) save_type_buffer.shiwei =0x20;
254 1 else return;
255 1 if( save_type_buffer.gewei ==0x30) save_type_buffer.gewei =0x20;
256 1 else return;
257 1 if( save_pizhong_buffer.baiwanwei ==0x30) save_pizhong_buffer.baiwanwei =0x20;
258 1 else return;
259 1 if( save_pizhong_buffer.shiwanwei ==0x30) save_pizhong_buffer.shiwanwei =0x20;
260 1 else return;
261 1 if( save_pizhong_buffer.wanwei ==0x30) save_pizhong_buffer.wanwei =0x20;
262 1 else return;
263 1 if( save_pizhong_buffer.qianwei ==0x30) save_pizhong_buffer.qianwei =0x20;
264 1 else return;
265 1 if( save_pizhong_buffer.baiwei ==0x30) save_pizhong_buffer.baiwei =0x20;
266 1 else return;
267 1 if( save_pizhong_buffer.shiwei ==0x30) save_pizhong_buffer.shiwei =0x20;
268 1 else return;
269 1
270 1
271 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1541 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 45 13
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 + -