⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 highres.inc.bak

📁 用SAM72N9写的电子秤文档
💻 BAK
📖 第 1 页 / 共 2 页
字号:
;----------------------------------------------------------------------------
;
;	Project		:	High Resolution Kitchen Scale
;	File		:	HighRes.INC
;	Creation Date	:	10 Oct 2000
;	By		:	KP Yiu (Oriental Skill Ltd.)
;	Release Date	:	
;	Release Version	:	v.1.01.0000
;
;----------------------------------------------------------------------------

       .list       off

; ----- ROM Map Definition ------
VectorTable:	.equ	000h	; Vector table start at 000h
Main1Loop:	.equ	00Ch	; main loop from 0ch to 1fh
LookupTable:	.equ	020h	; REF instruction look-up
				; table start at 020h-7Fh
Main2Loop:	.equ	080h	; main loop start at 080h

; ----- RAM Map Definition ------
VariableStart:	.equ	020h	; Variable start at 020h
RegisterBank	.equ	0
VariableBank	.equ	0
StackBank	.equ	0
LCDBank		.equ	1
MemoryBank	.equ	15
MemMapIOBank	.equ	15

; ----- Register Bank Definition -----
RegisterFG	.equ	0
RegisterINT1	.equ	1
RegisterCount	.equ	2
RegisterINTB	.equ	3

; ----- Register Address -----
REG_A		.equ	0
REG_E		.equ	1
REG_L		.equ	2
REG_H		.equ	3
REG_X		.equ	4
REG_W		.equ	5
REG_Z		.equ	6
REG_Y		.equ	7

; ----- Pin Functions -----
;
; For Kitchen Scale
; Port 2 is pulled-up
;
STOPCNT_PIN	.bit	P1.0	; 1 = Charged(input)
ONZERO_PIN	.bit	P1.1	; 0 = Pressed & held(input)
BAT_LOW_PIN	.bit	P1.2	; 1 = Battery low detected(input)
CREEP_OPT	.bit	P1.3	; 1 = Creeping eliminate enable
BUZZER_PIN	.bit	P2.3	; 1 = Buzzer off(output)

FEATUREPRT	.equ	P2	; Feature pins Port
AUTOZERO_PIN	.bit	P2.0	; 1 = Not Activate(default)
AUTOTIME_PIN	.bit	P2.1	; 1 = Auto power time(default)
BEEPON_PIN	.bit	P2.1	; 1 = No Beep(default)
AUTOOFF_PIN	.bit	P2.2	; 1 = Not Activate(default)

SCALEMODEPRT	.equ	P3	; Scale Weight Mode Setting Port
KEYCOL		.equ	P6	; Scan key Column input


KEYROW1_PIN	.bit	P80	; When scan key map, output 0
KEYROW2_PIN	.bit	P81	; When scan key map, output 0
;POWERON_PIN	.bit	P82	; Output 0 when Power on (9012 control)
DISCHARGE_PIN	.bit	P83	; Output 1 when discharge .22/.47u Cap
FEATURECHK_PIN	.bit	P84	; Output 0 when check option feature enable or not
MODESEL_PIN	.bit	P85	; Output 0 when scan mode setting

; tempory 
;FEATURECHK_PIN	.bit	P86	; Output 0 when check option feature enable or not
;MODESEL_PIN	.bit	P87	; Output 0 when scan mode setting

; -------- Communication Definition -----
; tempory IO
;MS_CLK		.bit	P84	; 
;MS_DOUT		.bit	P85	; 
;SL_DIN		.bit	P3.1

MS_CLK		.bit	P6.0	; 
MS_DOUT		.bit	P6.1	; 
SL_DIN		.bit	P1.1




; ----- Key code Definition -----
Total_Key	.equ	6	; Total num of key buttons(exclude On/Zero)
Key_OFF		.equ	0FEh	; Power off key
Key_KGLB	.equ	0FDh	; kg/lb select
Key_FlozML	.equ	0FBh	; Fl. oz / ml select
Key_Hold	.equ	0F7h	; Hold Key
Key_OnZero	.equ	0F7h	; on/zero key


; ----- defination key code by hcy
;Key_OFF		.equ	0F7h	; Power off key
;Key_KGLB	.equ	0FDh	; kg/lb select
;Key_FlozML	.equ	0FBh	; Fl. oz / ml select
;Key_Hold	.equ	0FEh	; Hold Key
;Key_OnZero	.equ	0FEh	; on/zero key


; define by hcy
Key_OnOff	EQU	0F6h
Key_OnKg	EQU	0F5h


; ----- WARM WORD -----
WARMWORD	.equ	5Ah	;

; ----- Timer/Delay Constants -----
DischargeDelay	.equ	87	; for T/C0 : 256/223.7kHz * (DischargeDelay+1) = 100.7ms
;-----
BCNT183ms_RL	.equ	11	; for Basic Timer: 36.6ms * (16-BCNT183ms_RL) = 183ms
BCNT2s_RL	.equ	5	; for Basic Timer: 183ms * (16-BCNT2s_RL) = 2.013s
DspChgn_RL	.equ	10	; for Basic Timer: 183ms * (16-RstZero_RL) = 1.098s
;-----
; remark by hcy 
;BCNT500ms_RL	.equ	2	; for Basic Timer: 2^17/3.5795M * (16-BCNT500ms_RL) = 512.6ms
; modify by hcy for kitchen clock about low battery delay 
BCNT500ms_RL	.equ	14	; for Basic Timer: 2^17/3.5795M * (16-BCNT500ms_RL) = 54ms
BCNT1s_RL	.equ	65536-437	; for Basic Timer: 2.29ms * (256-BCNT1s_RL) = 1.0001s

; ----- formula: 1.025s * (256-Reload value) = desired time
; 1 min = 60s = FFFh - 3Ch(60) = FC3h
; 1 min = 180s = FFFh - B4h(180) = F4Bh
IdleminH_RL	.equ	0Fh	; Reload value for idle 60s or 180s before sleep
Idle1minL_RL	.equ	256-60	; Reload value for idle 60s before sleep
Idle3minL_RL	.equ	256-180	; Reload value for idle 180s before sleep

;------ 10min = 600s = FFFh - 258h(600) = DA7h
Idle10minH_RL	.equ	0Dh 	; Reload value for idle 600s before sleep
Idle10minL_RL	.equ	0A7h	; Reload value for idle 600s before sleep

; ----- Tolerance difference of zero reading -----
TolerantZero	.equ	10	; 10 count
ZeroBndWidth1_3	.equ	18	; 18 count
ZeroBndWidth4	.equ	25	; 25 count
ZeroBndWidth5_8	.equ	30	; 30 count

; ----- Absolute Max Count -----
LoVoltBnd	.equ	00FA0h	; 4000 count  (~0.35v)
HiVoltBnd	.equ	02710h	; 10000 count (~0.45v)
AbsMaxCnt	.equ	0C800h	; 51200 count (~1.10v)

; ----- Creeping elimination -----
CreepingDif3	.equ	3	; 3 count
CreepingDif8	.equ	8	; 5 count
CreepingDif4	.equ	4	; 4 count
CreepTimer_RL6	.equ	4	; 0 -> 1 ... -> f (6s)
CreepTimer_RL8	.equ	0	; 0 -> 1 ... -> f (8s)
CreepTimer_RL4	.equ	8	; 0 -> 1 ... -> f (4s)

DspCountDiff	.equ	3	; Display count differenc
ZeroUpdate      .equ    12	; Zero return time (2s)
FstCreepBnd	.equ	15	; Fast Creeping Ajustment Range (15 cnts)
ZeroRtnUpBnd	.equ	3	; Zero return upper bound (-3 cnts)
ZeroRtnLowBnd	.equ	33	; Zero return lower bound (-33 cnts)
HoldChkTime	.equ	12

; ----- Set Sleep Timer Delay -----
ChgeSlpTmrDly	.equ	10	

; ----- Large Digit Definition -----
; for input of LDigit1xxx, LDigitx1xx,
; LDigitxx1x & LDigitxxx1
LDsp_0		.equ	0
LDsp_1  	.equ	1
LDsp_2		.equ	2
LDsp_3		.equ	3
LDsp_4		.equ	4
LDsp_5		.equ	5
LDsp_6		.equ	6
LDsp_7		.equ	7
LDsp_8		.equ	8
LDsp_9		.equ	9
LDsp_A		.equ	10
LDsp_B		.equ	8
LDsp_b		.equ	11
LDsp_C		.equ	12
LDsp_d		.equ	13
LDsp_E		.equ	14
LDsp_F		.equ	15
LDsp_H		.equ	16
LDsp_I		.equ	1
LDsp_L		.equ	17
LDsp_O		.equ	0
LDsp_r		.equ	18
LDsp_P		.equ	19
LDsp_t		.equ	20
LDsp_S		.equ	5
LDsp_U		.equ	21
LDsp__		.equ	22	; '-' display
LDspNul		.equ	23	; ' ' display

; ----- Small Digit Definition -----
; for input of SDigitx_8
SDsp_1_8	.equ	1
SDsp_2_8  	.equ	2
SDsp_3_8	.equ	3
SDsp_4_8	.equ	4
SDsp_5_8	.equ	5
SDsp_6_8	.equ	6
SDsp_7_8	.equ	7
SDsp_9_8	.equ	8
SDsp_Nul	.equ	9
SDsp_x_8	.equ	8

       .list       on
;=================================
; ----- Variables Definition -----
; ----- Range % 020h - 0afh  -----
; ----- Stack % 0b0h - 0ffh  -----
;=================================

	.ram_org	VariableStart	; 020h
	.align	2

	.ram_org	020h		;(020h - 02fh)
OperFlg1	.ram_ds	1		;(020)
 UnitMode:	.bit	OperFlg1.2	; b3,2 = 0: g(Default);  1 = oz; 2 = ml; 3 = fl.oz
 SolLiqMode:	.bit	OperFlg1.3	; 0 = solid, 1 = liquid

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -