📄 sam2_m.l
字号:
Tue Nov 04 18:10:06 2003
SAM4 Assembler for 57 Core Ver. 2.09T(Win32) Copyright(c) 1999 Samsung Electronics Co.
--------------------------------------------------------------------
Source File Name : Sam2_m.SRC
Output File Name : Sam2_m.o
List File Name : Sam2_m.l
1 ;----------------------------------------------------------------------------
2 ;
3 ; Project : High Resolution Kitchen SCALE
4 ; File : HighRes.src
5 ; : HighRes.inc
6 ; : 57c2304.reg
7 ; Creation Date : 10 Oct 2000
8 ; By : KP Yiu (Oriental Skill Ltd.)
9 ; Modified By : KL Tsang (Oriental Skill Ltd.)
10 ; Release Date :
11 ; Release Version : v.1.01.0000
12 ; Version Notes : v.1.01.0000
13 ;; - improve count fructration problem by adding PermitUpdate & modified
14 ;; AverageSample function.
15 ;; v.2.02.0000
16 ;; - improve auto-revert to zero feature to make the 2s counting more accurate.
17 ;; Develop Notes : High Resolution Scale
18 ;; v.0.6.0000
19 ;; - improve count taken problem after pull the scale
20 ;; - add 1s delay between Totalling and Tare for get stable count
21 ;; - zero bound change from fix 30 counts to 2 display step
22 ;; v.0.7.0000
23 ;; - add 3s delay before get zero
24 ;; - after creeping & 8s, if display weight = 0, put current count into zero
25 ;; - add 1.5s delay after press keys
26 ;; - change power control logic
27 ;; v.0.8.0000
28 ;; - after creeping and display zero, the time is changed from 8s to 2s
29 ;; - use new LCD
30 ;; v.0.9.0000
31 ;; - display 1x.xxx kg use new LCD
32 ;; - hold any keys, no display change
33 ;; v.0.10.0000
34 ;; - solve the sleep time problem -- scale don't sleep in 1 min after display is zero
35 ;; - add mode 1 - calculate the display
36 ;; - add display method for mode 1
37 ;; v.0.11.0000 (By Pang - 18 Feb 2002)
38 ;; - merge with Dennis program
39 ;; - Correct the mode table to display accurate 115% weight limit.
40 ;; - Correct the power up display as "8888 7/8" for mode 1-5,
41 ;; "18888 7/8" for mode 6 & 7 and "8888" for mode 8
42 ;; - Optimize the routine "SetFactoryMode"
43 ;; - Correct On/Zero button to MaB
44 ;; - Remark dummy instructions in routine "Sleep"
45 ;; v.0.12.0000 (By Pang - 25 Feb 2002)
46 ;; - update the program according to the email dated 25 Feb 2002 from Dennis
47 ;; -> Changed back power up display on mode 6 & 7 to "8888 7/8"
48 ;; -> Fix the power up click sound problem
49 ;; -> Fix a underweight bug
50 ;; v.1.5.0000 (By Dennis Wong - 3 Apr 2003)
51 ;; - Remove emulator rountine
52 ;; - Debug auto power off problem that sleep timer cannot reset at least 5sec
53 ;; v.1.6.0000 (By Dennis Wong - 28 Apr 2003)
54 ;; - Add fl.oz mode for all resolution
55 ;; v.1.6.0001 (By Dennis Wong - 28 May 2003)
56 ;; - Update the maximum capacity of fl.oz mode
57 ;; v.1.7.0000 (By Dennis Wong - 3 Jun 2003)
58 ;; - Use 'HoldEn' to be hold function enable flag to elimate calibration hold problem
59 ;; - Use 'TareNow' to be tare function enable flag
60 ;; - Modify clear icon rountine to free space
61 ;; - Debug fl.oz mode of 200g x 0.1g resolution
62 ;;
63 ;;---------------communication protocal----------------------
64 ;;
65 ;;---------------Communication protocol:
66 ; Name Samsung EPSON Name
67 ; MS_CLK P60 ---> K02 Clk_In
68 ; SL_DIN P11 <--- R01 SL_Dout
69 ; MS_DOUT P62 ---> P03 SL_Din ;
70 ;
71 ; Write to EPSON
72 ;1. Synchronized serial, 8 bit data, with master control
73 ;2. Samsung is the master of the communication
74 ;3. The LS bit will be sent first in a byte.
75 ;4. The clock bit is normal low and SL_Dout is normal high when no transmission.
76 ; Rising edge of clock bit to make attention to EPSON and place the data bit to MS_Dout.
77 ; Wait until EPSON response SL_Dout to Low and the clock bit goes to low to start
78 ; a bit cycle and the MS_Dout should return to high also.
79 ; The data bit is sent out on the falling edge of the clock
80 ;5. The data bit is assumed to be read out by EPson on the falling edge of the SL_Dout.
81 ;6. The clock line will keep on low when all 8 bits data has been sent out
82 ;
83 ;7. The clock rate is around 0.5KHz
84 ;8. The timeout time of the response is 0.6 seconds (don't be equal to the multiple of 0.5 sec)
85 ;9. The command will be sent to Epson again.
86 ;
87 ; Data return to Samsung (master)
88 ;1. Synchronized serial, 8 bit data, with master control
89 ;2. Samsung is the master of the communication
90 ;3. The LS bit will be sent first in a byte.
91 ;4. The 1st rising edge of clock bit is an attention signal to Epson to place the data
92 ; to SL_Out. This data will be get into Master just before the next rising edge of clock bit.
93 ; Therefore there are total 9 clock bits to get 8-bit date from Epson.
94 ;5. The clock rate is around 400Hz
95 ;
96 ; Command codes of the communication
97 ;1. The communication begins with code (1BH)
98 ;2. A byte of command code follows with 1BH
99 ; e.g. Sending a command 'Read Key status' from Master to Epson: 1BH, 'O'
100 ;
101 ; CPU's Commands: Code Complete code Epson response
102 ;
103 ;Read key status '1' 1BH,'1' return with key status
104 ;Show large weight '2' 1Bh,'2' ldigit1xxx,ldigitx1xx,ldigitxx1x,ldigitxxx1
105 ;Show fraction Weight '3' 1Bh,'3' ldigit1xxx,ldigitx1xx,ldigitxx1x,ldigitxxx1
106 ;Show icon '4' 1BH,'4' iconset0,iconset1,iconset2,iconset3
107 ;Show Message '5' 1BH,'5' ldigit1xxx,ldigitx1xx,ldigitxx1x,ldigitxxx1
108 ;??? Agree to sleep mode '9' 1BH, '9'
109 ;
110 ;
111 ;
112 ;
113 ;4. The Epson should ignor all un-defined commands
114 ;
115 ;
116
117 ;9. The send and receive data is done in back-ground. However the send/receive data must be double buffered.
118 ;
119 ;10. A counter is used to indicate number of bits received or number of bits left to send.
120 ;
121 ;11. A flag is used to indicate end of sending 8-bit data.
122 ;
123 ;12. A flag is used to indicate end of receiving 8-bit data.
124 ;----------------------------------------------------------------------------
125
126 .include "57c2304.reg"
127 ; 57C2304.REG Copyright (c) 1996 SAMSUNG ELECTRONICS CO.
128
129 .list on
130
131 ; END OF 57C2304.REG
132
133
134 .include "HighRes.inc"
135 ;----------------------------------------------------------------------------
136 ;
137 ; Project : High Resolution Kitchen Scale
138 ; File : HighRes.INC
139 ; Creation Date : 10 Oct 2000
140 ; By : KP Yiu (Oriental Skill Ltd.)
141 ; Release Date :
142 ; Release Version : v.1.01.0000
143 ;
144 ;----------------------------------------------------------------------------
145
146 .list on
147 ;=================================
148 ; ----- Variables Definition -----
149 ; ----- Range % 020h - 0afh -----
150 ; ----- Stack % 0b0h - 0ffh -----
151 ;=================================
152
153 0000 .ram_org VariableStart ; 020h
154 02 .align 2
155
156 0000 .ram_org 020h ;(020h - 02fh)
157 20 OperFlg1 .ram_ds 1 ;(020)
158 20 32 UnitMode: .bit OperFlg1.2 ; b3,2 = 0: g(Default); 1 = oz; 2 = ml; 3 = fl.oz
159 20 33 SolLiqMode: .bit OperFlg1.3 ; 0 = solid, 1 = liquid
160
161 21 OperFlg2 .ram_ds 1 ;(021)
162 21 30 KeyHeldNow: .bit OperFlg2.0 ; b0 = 1: Key held now
163 21 31 CntPeriodNow: .bit OperFlg2.1 ; b1 = 0: Discharging Period; 1:Counting Period
164 21 32 CntDspNow: .bit OperFlg2.2 ; b2 = 1: Count display
165 21 33 WeightTareNow: .bit OperFlg2.3 ; b3 = 1: Weight Tare Now
166 22 OperFlg3 .ram_ds 1 ;(022)
167 22 30 Chge4stepNow: .bit OperFlg3.0 ; b0 = 1: 4 steps changed Now
168 22 31 ZeroDspNow: .bit OperFlg3.1 ; b1 = 1: Screen show zero now
169 22 32 CalibrateOn: .bit OperFlg3.2 ; b2 = 1: Enable Calibration mode
170 22 33 CaliMethod: .bit OperFlg3.3 ; b3 = 1: Calibration Method 2, 0: Calibration Method 1
171 23 OperFlg4 .ram_ds 1 ;(023)
172 23 30 CreepZero: .bit OperFlg4.0
173 23 31 AutoZeroNow: .bit OperFlg4.1 ; b1 = 1: Auto revert to Zero now
174 23 32 HexCalFlg: .bit OperFlg4.2 ; b2 = 1: Hexadecimal calculation
175 23 33 EnCreeping: .bit OperFlg4.3 ; b2 = 1: Enable creeping elimination
176 24 OperFlg5 .ram_ds 1 ;(024)
177 24 30 SleepNow: .bit OperFlg5.0 ; b0 = 1: Sleep time rearched 0
178 24 31 TimrFinished: .bit OperFlg5.1 ; b1 = 1: Creep time finished
179 24 32 HoldEn: .bit OperFlg5.2 ; b2 = 1: Hold function enable
180 24 33 TareNow: .bit OperFlg5.3 ; b3 = 1: Tare occur
181 25 OperFlg6 .ram_ds 1 ;(025)
182 25 30 AutoZeroEn: .bit OperFlg6.0 ; b0 = 1: Auto-zero feature enabled
183 25 31 PowerOffTim: .bit OperFlg6.1 ; b1 = 1: 3min Auto power off time
184 25 32 AutoOffEn: .bit OperFlg6.2 ; b2 = 0: Auto power off feature enabled
185 25 33 UnitSwOpt: .bit OperFlg6.3 ; b3 = 0: priority switch
186
187 26 OperFlg7 .ram_ds 1 ;(026)
188 26 30 OvrHiVoltNow: .bit OperFlg7.0 ; b0 = 1: Over Hi-Volt Boundary Now
189 26 31 BlwLoVoltNow: .bit OperFlg7.1 ; b1 = 1: Below Lo-Volt Boundary Now
190 26 32 OvrAbMaxNow: .bit OperFlg7.2 ; b2 = 1: Now Over Absolute Max Count
191 26 33 IdleBatLowNow: .bit OperFlg7.3 ; b3 = 1: Battery Low display Now
192
193 27 OperFlg8 .ram_ds 1 ;(027)
194 27 30 CnstRdNow: .bit OperFlg8.0 ; b0 = 1: Constant reading now
195 27 31 OvrWtNow: .bit OperFlg8.1 ; b1 = 1: Overloading now
196 27 32 UdrWtNow: .bit OperFlg8.2 ; b2 = 1: Underweighting now
197 27 33 ZeroRdNow: .bit OperFlg8.3 ; b3 = 1: Zero reading now
198
199 28 OperFlg9 .ram_ds 1 ;(028)
200 28 30 IdleCnstRdNow: .bit OperFlg9.0 ; b0 = 1: Constant Reading Now
201 28 31 IdleOvrWtNow: .bit OperFlg9.1 ; b1 = 1: Error display Now
202 28 32 IdleUdrWtNow: .bit OperFlg9.2 ; b2 = 1: Underweight display Now
203 28 33 IdleZeroRdNow: .bit OperFlg9.3 ; b3 = 1: Zero Reading Now
204
205 29 BCNT_183ms .ram_ds 1 ;(029) Count 183ms from BCNT Count
206 2A BCNT_500ms .ram_ds 1 ;(02A) Count 513ms from BCNT Counter
207
208 2B OperFlg10 .ram_ds 1 ;(02B)
209 2B 30 CntOvrflow: .bit OperFlg10.0 ; b0 = 1: discharge counting overflow (mean reg L)
210 2B 31 TotalFlag: .bit OperFlg10.1 ; b1 = 1: Totalling occur
211 2B 32 ChgeSlpTmrNow: .bit OperFlg10.2 ; b2 = 1 : Change Sleep Timer Now
212 2B 33 ZeroOne: .bit OperFlg10.3 ; b3 = 1: reading = 0 to 1
213
214 2C ZeroCount .ram_ds 4 ;(02C) Zero Reading Count in hex(2B)
215
216 0000 .ram_org 034h ;(034h - 03fh)
217 34 BCNT_36ms .ram_ds 1 ;(034) Count 36.6ms from BCNT Counter
218 35 BCNT_1s_H .ram_ds 1 ;(035) Count 1s from BCNT Counter (High nibble)
219 36 BCNT_1s_M .ram_ds 1 ;(036) Count 1s from BCNT Counter (Middle nibble)
220 37 BCNT_1s_L .ram_ds 1 ;(037) Count 1s from BCNT Counter (Low nibble)
221
222 0000 .ram_org 038h
223 38 StartZero .ram_ds 4 ;(038) Store first zero reading turn on
224 3C SleepTimL .ram_ds 2 ;(03C) Sleep timer
225 3E SleepTimH .ram_ds 1 ;(03E) Sleep timer
226 3F HoldTimer .ram_ds 1 ;(03F) Hold timer
227
228 0000 .ram_org 045h ;(045h - 04bh)
229 45 FactoryMode .ram_ds 1 ;(045) Factory setting of Mode(0..7)
230 45 30 FtyMode_K1: .bit FactoryMode.0 ; b0 = K1
231 45 31 FtyMode_K2: .bit FactoryMode.1 ; b1 = K2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -