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

📄 sam2_m.l

📁 用SAM72N9写的电子秤文档
💻 L
📖 第 1 页 / 共 5 页
字号:
  232         45 32       FtyMode_K3:	.bit	FactoryMode.2	; b2 = K3
  233         45 33       FtyMode_K4:	.bit	FactoryMode.3	; b3 = K4
  234         46         AverageCount	.ram_ds	4		;(046) Average Count of Sample Count 0 & 1 in hex
  235         4A         LDigitPos	.ram_ds	1		;(04A) LCD Large Digit Position (0..3)
  236         4B         AutoZeroTim	.ram_ds	1		;(04B) Auto revert to zero delay timer
  237                    
  238  0000              	.ram_org	056h		;(056h - 05fh)
  239         56         SampleCount0	.ram_ds	4		;(056) Sample Count 0 in hex(2B)
  240         5A         SampleCount1	.ram_ds	4		;(05A) Sample Count 1 in hex(2B)
  241         5E         CntTCNT		.ram_ds	2		;(05E) Count num of TCNT Match
  242                    
  243  0000              	.ram_org	066h		;(066h - 06fh)
  244         66         PreviousCount	.ram_ds	4		;(066) Previous count for creeping checking
  245         6A         NewWeightCnt	.ram_ds	4		;(06A) Weight Count = Average Count - Zero Count in hex
  246         6E         Tag2sec		.ram_ds	2		;(06E) Store 2sec time for key hold
  247                    
  248  0000              	.ram_org	075h		;(075h - 07fh)
  249         75         MaB_Key		.ram_ds	1		;(075) Flag for Mab key
  250         75 30       KeyKGLB:	.bit	MaB_Key.0	; kg/lb key
  251         75 31       KeyFlozML:	.bit	MaB_Key.1	; Fl.oz/ml key
  252         75 32       KeyHold:	.bit	MaB_Key.2	; Hold key
  253                     
  254         76         SleepTimLRL	.ram_ds	2		;(076) Sleep Timer Low nibble Reload value
  255         78         SleepTimHRL	.ram_ds	1		;(078) Sleep Timer High nibble Reload value
  256         79         CreepTimer	.ram_ds	1		;(079) Creeping timer
  257         7A         ZeroBound	.ram_ds	4		;(07A) Zero Boundary to display underload(absolute count)
  258         7E         SDigitx_8	.ram_ds	1		;(07E) LCD Small Digit display Value
  259         7F         HoldState	.ram_ds 1		;(07F) For Hold check stable count
  260         7F 30       HoldStableChk:	.bit	HoldState.0	; b0 = 1: Goto check hold stable
  261         7F 31       HoldRd:	.bit	HoldState.1	; b1 = 1: Holding Reading
  262         7F 32       HoldRdChange:	.bit	HoldState.2	; b2 = 1: Hold Reading Change
  263         7F 33       HoldNotAllow:	.bit	HoldState.3	; b3 = 1: Hold Reading is allowed
  264                    
  265  0000              	.ram_org	085h
  266         85         HaveData	.ram_ds	1		;(085) Sampling Flags
  267         85 30       HaveSample0:	.bit	HaveData.0	; Bit 0 = 0: Sample Count 0 is Empty
  268         85 31       HaveSample1:	.bit	HaveData.1	; Bit 1 = 0: Sample Count 1 is Empty
  269         85 32       UpdateSample0:	.bit	HaveData.2	; Bit 2 = 0: Update Sample 0
  270         85 33       PermitUpdate:	.bit	HaveData.3	; Bit 3 = 0: Permit update Sample
  271         86         Iconset0	.ram_ds	1		;(086) lb, kg, S3 icons (can directly load to 1e0h for dsp)
  272         86 30       Icon_lb:	.bit	Iconset0.0	; lb icon       (Iconset0 must at even address)
  273         86 31       Icon_kg:	.bit	Iconset0.1	; kg icon
  274         86 32       Icon_LoBat:	.bit	Iconset0.2	; low battery icon (S3)
  275         86 33       Icon_DPt2:	.bit	Iconset0.3	; decimal pt. 2 icon "##.###"
  276         87         Iconset1	.ram_ds	1		;(087) P1, COL, g, oz icons
  277         87 30       Icon_DPt1:	.bit	Iconset1.0	; decimal pt. 1 icon "#.####"
  278         87 31       Icon_Col:	.bit	Iconset1.1	; colon mark icon
  279         87 32       Icon_g:	.bit	Iconset1.2	; g icon
  280         87 33       Icon_oz:	.bit	Iconset1.3	; oz icon
  281         88         Iconset2	.ram_ds	1		;(088) S2, S1, fl.oz, ml icons (can load directly for dsp)
  282         88 30       Icon_Hold:	.bit	Iconset2.0	; Hold icon (S2)
  283                    ; Icon_Timr:	.bit	Iconset2.1	; Timer icon (S1)
  284         88 32       Icon_fl:	.bit	Iconset2.2	; fl.oz icon
  285         88 33       Icon_ml:	.bit	Iconset2.3	; ml icon
  286         89         Iconset3	.ram_ds	1		;(089)
  287         89 30       Icon_DPt3:	.bit	Iconset3.0	; Decimal pt. 3 icon "####.#"
  288         89 31       Icon_Tare:	.bit	Iconset3.1	; Tare icon
  289         89 32       Icon_One:      .bit    Iconset3.2      ; One 
  290                     
  291         8A         Chge4stepTimer		.ram_ds	1		;(08A) For 4 step change delay
  292                    
  293  0000              	.ram_org	08Ch
  294         8C         HoldChkCount		.ram_ds	4		;(08C) 
  295                    
  296                    ; the followings variables need a fixed address
  297         00 30      HexBuf		.equ	030h	; Max 16-bit Hex
  298         00 30      HexBuf0		.equ	030h	; most msb
  299         00 31      HexBuf1		.equ	031h	;
  300         00 32      HexBuf2		.equ	032h	;
  301         00 33      HexBuf3		.equ	033h	; most lsb
  302                    
  303         00 40      DecBuf		.equ	040h	; Max 5-digit BCD
  304         00 40      DecBuf0		.equ	040h	; most msb
  305         00 41      DecBuf1		.equ	041h	;
  306         00 42      DecBuf2		.equ	042h	;
  307         00 43      DecBuf3		.equ	043h	;
  308         00 44      DecBuf4		.equ	044h	; most lsb
  309                    
  310                    ; the followings variables need a fixed address
  311         00 4C      LDigit___1	.equ	4ch	; LCD Large Digit dsp for decimal place(1B)
  312         00 4E      LDigitxxx1	.equ	4eh	; LCD Large Digit dsp value(1B)
  313         00 50      LDigitxx1x	.equ	50h	; LCD Large Digit dsp value(1B)
  314         00 52      LDigitx1xx	.equ	52h	; LCD Large Digit dsp value(1B)
  315         00 54      LDigit1xxx	.equ	54h	; LCD Large Digit dsp value(1B)
  316                    
  317                    ; for arithmetic calculation
  318         00 60      YS_F_REG        .equ	060h
  319         00 60      YS_F_REG_0      .equ	060h	; most msb
  320         00 61      YS_F_REG_1      .equ	061h	;
  321         00 62      YS_F_REG_2      .equ	062h	;
  322         00 63      YS_F_REG_3      .equ	063h	;
  323         00 64      YS_F_REG_4      .equ	064h	; most lsb
  324                    
  325         00 70      YS_L_REG        .equ	070h
  326         00 70      YS_L_REG_0      .equ	070h	; most msb
  327         00 71      YS_L_REG_1      .equ	071h	;
  328         00 72      YS_L_REG_2      .equ	072h	;
  329         00 73      YS_L_REG_3      .equ	073h	;
  330         00 74      YS_L_REG_4      .equ	074h	; most lsb
  331                    
  332         00 80      YS_R_REG        .equ	080h
  333         00 80      YS_R_REG_0      .equ	080h	; most msb
  334         00 81      YS_R_REG_1      .equ	081h	;
  335         00 82      YS_R_REG_2      .equ	082h	;
  336         00 83      YS_R_REG_3      .equ	083h	;
  337         00 84      YS_R_REG_4      .equ	084h	; most lsb
  338                    
  339                    ; the followings variables need a fixed address
  340         00 90      NewWeightBCD	.equ	090h	; New Weight obtained from AverageCount(2B)
  341         00 90      NewWeightBCD0	.equ	090h	; most msb
  342         00 91      NewWeightBCD1	.equ	091h	;
  343         00 92      NewWeightBCD2	.equ	092h	;
  344         00 93      NewWeightBCD3	.equ	093h	;
  345         00 94      NewWeightBCD4	.equ	094h	; most lsb
  346                    
  347                    
  348                    ; the followings variables need a fixed address
  349         00 96      Step1		.equ	096h	; 1st region dsp step(2B) - multipied by 10
  350         00 9A      Bound1		.equ	09Ah	; 1st Boundary of weighting display(2B)
  351         00 9A      MaxBound	.equ	09Ah	; MaxBound
  352         00 9E      UnitCnt		.equ	09Eh	; Unit count value(1B)
  353         00 9E      gRatio		.equ	09Eh	; - 1g count ratio
  354         00 9E      oz1_8Ratio	.equ	09Eh	; - 1/8oz count ratio
  355         00 A0      ozRatio		.equ	0A0h	; 1oz count ratio(2B)
  356         00 A4      lbRatio		.equ	0A4h	; 1lb count ratio(2B)
  357                    
  358                    ;-----------------------------
  359         00 A8      TimeoutTmr	.equ	0A8h	; (1N) communication timeout timer 183*3 ms
  360                    
  361                    	.list on
  362                    
  363                    ;-----------------
  364         00 01      VerD1		.equ	1
  365         00 08      VerD2		.equ	8
  366                    
  367                    ;----------------------------------------------------------------------------
  368                    
  369  0000              	.origin	VectorTable
  370  0000              ResetVector
  371  0000   8B AD      	VENT0	1,0,Reset	; Reset Vector
  372  0002   C0 8D      	VENT1	1,1,INTB_Int	;
  373  0004   C1 2F      	VENT2	1,1,INT0_Int	;
  374  0006   C0 80      	VENT3	1,1,INT1_Int	;
  375  000A              	ORG	00ah		;
  376  000A   C1 89      	VENT5	1,1,INTT0_Int	;
  377                    
  378                    ;----------------------------------------------------------------------------
  379                    ;
  380  000C              	.origin	Main1Loop
  381                    
  382                    ;----------------------------------------------------------------------------
  383  000C   DD 66      IRETSB	POP	SB
  384  000E   D5         	IRET
  385                    ;----------------------------------------------------------------------------
  386  000F   2A         RETHLEA	POP	HL
  387  0010   28         	POP	EA
  388  0011   C5         	RET
  389                    ;----------------------------------------------------------------------------
  390  0012              RETWXHLEA
  391  0012   2C         	POP	WX
  392  0013   2A         	POP	HL
  393  0014   28         	POP	EA
  394  0015   C5         	RET
  395                    ;----------------------------------------------------------------------------
  396  0016              RETYZWXHLEA
  397  0016   2E         	POP	YZ
  398  0017   2C         	POP	WX
  399  0018   2A         	POP	HL
  400  0019   28         	POP	EA
  401  001A   C5         	RET
  402                    
  403                    ;***********************************************************
  404                    ;	F: Copy Buf to Buf from xyH to x0H where x & y are any hex num
  405                    ;	I: HL = Destination Buf(Buf end pointer)
  406                    ;	   WL = Source Buf(Buf end pointer)
  407                    ;	O: HL = Duplicated Buf
  408                    ;	D: A, HL
  409                    ;
  410  001B   8F         CpyBuf	LD	A,@WL		;
  411  001C   7B         	XCHD	A,@HL		;
  412  001D   0D         	JR	CpyBuf		;
  413  001E   C5         	RET
  414                    
  415                    ;----------------------------------------------------------------------------
  416                    ;
  417  0020              	.origin	LookupTable
  418                    
  419  0020   DD 40      RSMB_Variable	SMB	VariableBank
  420  0022   DD 4F      RSMB_MemMapIO	SMB	MemMapIOBank
  421  0024   DD 41      RSMB_LCD	SMB	LCDBank
  422                    
  423  0026   82         RINCS_2HL	INCS	HL		;
  424  0027   82         		INCS	HL		;
  425  0028   DC DA      RDECS_HL	DECS	HL		;
  426  002A   DC F2      RLD_HLEA	LD	HL,EA		;
  427  002C   DC F4      RLD_WXEA	LD	WX,EA		;
  428  002E   81 00      RLD_EA0		LD	EA,#0		;
  429  0030   D9 09      RLD_E0		LD	E,#0		;
  430  0032   D9 00      RCPSE_A0	CPSE	A,#0		;
  431  0034   DC EA      RCPSE_EAHL	CPSE	EA,HL		;
  432  0036   DC AA      RADC_EAHL	ADC	EA,HL		;
  433                    
  434                    
  435  0038   CD 4E      RLD_LDIGxxx1EA	LD	LDigitxxx1,EA
  436  003A   CD 50      RLD_LDIGxx1xEA	LD	LDigitxx1x,EA
  437                    
  438  003C   44 4B      RDiv_YS		TCALL	Div_YS
  439  003E   44 91      RRound_YS	TCALL	Round_YS
  440  0040   49 8F      RMul_10_FReg	TCALL	Mul_10_FReg
  441  0042   49 98      RDiv_10_FReg	TCALL	Div_10_FReg
  442  0044   44 3B      RDouble_YS	TCALL	Double_YS
  443                    
  444  0046   49 9F      RCmpHex		TCALL	CmpHex
  445  0048   40 1B      RCpyBuf		TCALL	CpyBuf
  446  004A   49 43      RHex2BCD_16	TCALL	Hex2BCD_16
  447  004C   4A 00      RSubHex		TCALL	SubHex
  448                    
  449  004E   4A 29      RSkipSRC_YZ	TCALL	SkipSRC_YZ
  450  0050   49 67      RByteAry	TCALL	ByteAry
  451  0052   49 6F      RWrd2Ary	TCALL	Wrd2Ary
  452  0054   4C F8      RStoreWordCode	TCALL	StoreWordCode
  453  0056   4C F2      RStoreByteCode	TCALL	StoreByteCode
  454                    
  455  0058   4D 38      RDspSDigit	TCALL	DspSDigit
  456  005A   4D 66      RDsp4LDigit	TCALL	Dsp4LDigit
  457  005C   4D 72      RDspSymbol	TCALL	DspSymbol
  458                    
  459  005E   4A B6      RKScanDelay	TCALL	KScanDelay
  460                    
  461  0060   48 1E      RCalWeightCnt	TCALL	CalWeightCount
  462  0062   48 C8      RActCurStp2Ary	TCALL	ActlCurStep2Ary
  463  0064   48 C1      RCurStep2Ary	TCALL	CurStep2Ary
  464  0066   48 D7      RSetBnd		TCALL	SetBnd
  465  0068   48 F7      RGetAverageCnt	TCALL	GetAverageCnt
  466  006A   48 3B      RAverageSample  TCALL   AverageSample
  467                    
  468  006C   49 29      RNWCnt2FReg	TCALL	NWCnt2FReg
  469  006E   49 2F      RHxFReg2Dec	TCALL   HxFReg2Dec
  470  0070   49 38      RCpy_R2FReg	TCALL	Cpy_R2FReg
  471  0072   49 3B      RCpy_F2LReg	TCALL	Cpy_F2LReg
  472  0074   4A 69      RPutDec		TCALL	PutDec
  473                    
  474  0076   DD 67      RPush_SB	PUSH	SB

⌨️ 快捷键说明

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