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

📄 samtestc.l

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

⌨️ 快捷键说明

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