📄 rs232.lst
字号:
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 RS232 05/27/2006 14:01:03 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 RS232 05/27/2006 14:01:03 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
9 extern WORD PLU_no;
10 extern DWORD Unit_Price;
11 extern WORD Weight;
12 extern WORD Quantity;
13 extern DWORD Total_Price;
14 extern TIME time;
15 extern DATE date;
16 extern WORD Sold_Quantity;
17 extern DWORD Sum_Price;
18 extern BYTE Record_buf[RECORD_LEN];
19 extern BYTE PLU_buf[PLU_LEN];
20
21 extern VOID Record_Load(WORD temp);
22
23 VOID RS232_Init()
24 {
25 1 SCON=0x42;
26 1 RCAP2H=V_TH2;
27 1 TH2=V_TH2;
28 1 RCAP2L=V_TL2;
29 1 TL2=V_TL2;
30 1 TCLK=1;
31 1 RCLK=1;
32 1 TR2=1;
33 1 while(!RXD);
34 1 REN=1;
35 1 }
36
37 VOID Put_Byte(BYTE b)
38 {
39 1 while(!TI);
40 1 TI=0;
41 1 SBUF=b;
42 1 }
43
44 BYTE Get_Byte()
45 {
46 1 BYTE b;
47 1 while(!RI);
48 1 b=SBUF;
49 1 RI=0;
50 1 return(b);
51 1 }
52
53 VOID Print_PLU_no(WORD temp)
54 {
55 1 INT8 data i,adr=0;
56 1 BYTE temp_buf[4];
57 1 DWORD divisor=1000;
58 1 for(i=3;i>=0;i--)
59 1 {
60 2 temp_buf[i]=temp/divisor;
61 2 temp=temp-temp_buf[i]*divisor;
62 2 divisor=divisor/10;
C51 COMPILER V7.50 RS232 05/27/2006 14:01:03 PAGE 9
63 2 }
64 1 for(i=1;i>=0;i--)
65 1 {
66 2 Record_buf[PLU_no_Save_address+adr]=temp_buf[i*2+1];
67 2 Record_buf[PLU_no_Save_address+adr]=Record_buf[PLU_no_Save_address+adr]<<4;
68 2 Record_buf[PLU_no_Save_address+adr]+=temp_buf[i*2];
69 2 Put_Byte(Record_buf[PLU_no_Save_address+adr]);
70 2 adr++;
71 2 }
72 1 }
73
74 VOID Print_Unit_Price(DWORD temp)
75 {
76 1 INT8 data i,adr=0;
77 1 BYTE temp_buf[6];
78 1 DWORD divisor=100000;
79 1 for(i=5;i>=0;i--)
80 1 {
81 2 temp_buf[i]=temp/divisor;
82 2 temp=temp-temp_buf[i]*divisor;
83 2 divisor=divisor/10;
84 2 }
85 1 for(i=2;i>=0;i--)
86 1 {
87 2 Record_buf[Unit_Price_Save_address+adr]=temp_buf[i*2+1];
88 2 Record_buf[Unit_Price_Save_address+adr]=Record_buf[Unit_Price_Save_address+adr]<<4;
89 2 Record_buf[Unit_Price_Save_address+adr]+=temp_buf[i*2];
90 2 Put_Byte(Record_buf[Unit_Price_Save_address+adr]);
91 2 adr++;
92 2 }
93 1 }
94
95 VOID Print_Weight(DWORD temp)
96 {
97 1 INT8 data i,adr=0;
98 1 BYTE temp_buf[6];
99 1 DWORD divisor=100000;
100 1 for(i=5;i>=0;i--)
101 1 {
102 2 temp_buf[i]=temp/divisor;
103 2 temp=temp-temp_buf[i]*divisor;
104 2 divisor=divisor/10;
105 2 }
106 1 for(i=2;i>=0;i--)
107 1 {
108 2 Record_buf[Weight_Save_address+adr]=temp_buf[i*2+1];
109 2 Record_buf[Weight_Save_address+adr]=Record_buf[Weight_Save_address+adr]<<4;
110 2 Record_buf[Weight_Save_address+adr]+=temp_buf[i*2];
111 2 Put_Byte(Record_buf[Weight_Save_address+adr]);
112 2 adr++;
113 2 }
114 1 }
115
116 VOID Print_Quantity(DWORD temp)
117 {
118 1 INT8 data i,adr=0;
119 1 BYTE temp_buf[4];
120 1 DWORD divisor=1000;
121 1 for(i=3;i>=0;i--)
122 1 {
123 2 temp_buf[i]=temp/divisor;
124 2 temp=temp-temp_buf[i]*divisor;
C51 COMPILER V7.50 RS232 05/27/2006 14:01:03 PAGE 10
125 2 divisor=divisor/10;
126 2 }
127 1 for(i=1;i>=0;i--)
128 1 {
129 2 Record_buf[Quantity_Save_address+adr]=temp_buf[i*2+1];
130 2 Record_buf[Quantity_Save_address+adr]=Record_buf[Quantity_Save_address+adr]<<4;
131 2 Record_buf[Quantity_Save_address+adr]+=temp_buf[i*2];
132 2 Put_Byte(Record_buf[Quantity_Save_address+adr]);
133 2 adr++;
134 2 }
135 1 Record_buf[Quantity+2]=0x00;
136 1 }
137
138 VOID Print_Total_Price(DWORD temp)
139 {
140 1 INT8 data i,adr=0;
141 1 BYTE temp_buf[8];
142 1 DWORD divisor=10000000;
143 1 for(i=7;i>=0;i--)
144 1 {
145 2 temp_buf[i]=temp/divisor;
146 2 temp=temp-temp_buf[i]*divisor;
147 2 divisor=divisor/10;
148 2 }
149 1 for(i=3;i>=0;i--)
150 1 {
151 2 Record_buf[Total_Price_Save_address+adr]=temp_buf[i*2+1];
152 2 Record_buf[Total_Price_Save_address+adr]=Record_buf[Total_Price_Save_address+adr]<<4;
153 2 Record_buf[Total_Price_Save_address+adr]+=temp_buf[i*2];
154 2 Put_Byte(Record_buf[Total_Price_Save_address+adr]);
155 2 adr++;
156 2 }
157 1 }
158
159 VOID Print_Date()
160 {
161 1 INT8 data i;
162 1 BYTE temp_buf[6];
163 1 temp_buf[0]=date.year%10;
164 1 temp_buf[1]=date.year/10;
165 1 temp_buf[2]=date.month%10;
166 1 temp_buf[3]=date.month/10;
167 1 temp_buf[4]=date.day%10;
168 1 temp_buf[5]=date.day/10;
169 1 for(i=0;i<3;i++)
170 1 {
171 2 Record_buf[0]=temp_buf[i*2+1];
172 2 Record_buf[0]=Record_buf[0]<<4;
173 2 Record_buf[0]+=temp_buf[i*2];
174 2 Put_Byte(Record_buf[0]);
175 2 }
176 1 }
177 VOID Print_Time()
178 {
179 1 INT8 data i;
180 1 BYTE temp_buf[4];
181 1 temp_buf[0]=time.hour%10;
182 1 temp_buf[1]=time.hour/10;
183 1 temp_buf[2]=time.min%10;
184 1 temp_buf[3]=time.min/10;
185 1 for(i=0;i<2;i++)
186 1 {
C51 COMPILER V7.50 RS232 05/27/2006 14:01:03 PAGE 11
187 2 Record_buf[0]=temp_buf[i*2+1];
188 2 Record_buf[0]=Record_buf[0]<<4;
189 2 Record_buf[0]+=temp_buf[i*2];
190 2 Put_Byte(Record_buf[0]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -