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

📄 stm8_tsl_rc_services.ls

📁 STM8-触摸例程
💻 LS
📖 第 1 页 / 共 2 页
字号:
   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Generator V4.2.8 - 03 Dec 2008
   3                     ; Optimizer V4.2.8 - 03 Dec 2008
  71                     ; 51 void TSL_SetStructPointer(void)
  71                     ; 52 {
  73                     	switch	.text
  74  0000               _TSL_SetStructPointer:
  78                     ; 53   pKeyStruct = &sSCKeyInfo[KeyIndex];
  80  0000 b600          	ld	a,_KeyIndex
  81  0002 97            	ld	xl,a
  82  0003 a60f          	ld	a,#15
  83  0005 42            	mul	x,a
  84  0006 01            	rrwa	x,a
  85  0007 ab00          	add	a,#_sSCKeyInfo
  86  0009 5f            	clrw	x
  87  000a 97            	ld	xl,a
  88  000b bf00          	ldw	_pKeyStruct,x
  89                     ; 54 }
  92  000d 81            	ret	
 118                     ; 67 void TSL_DeltaCalculation(void)
 118                     ; 68 {
 119                     	switch	.text
 120  000e               _TSL_DeltaCalculation:
 124                     ; 69   Delta = (s16)(pKeyStruct->Channel.LastMeas - pKeyStruct->Channel.Reference);
 126  000e be00          	ldw	x,_pKeyStruct
 127  0010 90be00        	ldw	y,_pKeyStruct
 128  0013 ee05          	ldw	x,(5,x)
 129  0015 90ee08        	ldw	y,(8,y)
 130  0018 90bf00        	ldw	c_x,y
 131  001b 72b00000      	subw	x,c_x
 132  001f bf00          	ldw	_Delta,x
 133                     ; 70 }
 136  0021 81            	ret	
 162                     ; 84 void TSL_SCKey_SetIdleState(void)
 162                     ; 85 {
 163                     	switch	.text
 164  0022               _TSL_SCKey_SetIdleState:
 168                     ; 86   pKeyStruct->Setting.b.CHANGED = 1;
 170  0022 be00          	ldw	x,_pKeyStruct
 171  0024 e602          	ld	a,(2,x)
 172  0026 aa08          	or	a,#8
 173  0028 e702          	ld	(2,x),a
 174                     ; 87   TSL_SCKey_BackToIdleState();
 177                     ; 88 }
 180  002a 2000          	jp	_TSL_SCKey_BackToIdleState
 205                     ; 102 void TSL_SCKey_BackToIdleState(void)
 205                     ; 103 {
 206                     	switch	.text
 207  002c               _TSL_SCKey_BackToIdleState:
 211                     ; 104   pKeyStruct->State.whole = IDLE_STATE;
 213  002c a602          	ld	a,#2
 214  002e 92c700        	ld	[_pKeyStruct.w],a
 215                     ; 105   pKeyStruct->Setting.b.DETECTED = 0;
 217  0031 be00          	ldw	x,_pKeyStruct
 218  0033 e602          	ld	a,(2,x)
 219                     ; 106   pKeyStruct->Setting.b.LOCKED = 0;
 221                     ; 107   pKeyStruct->Setting.b.ERROR = 0;
 223  0035 a45b          	and	a,#91
 224  0037 e702          	ld	(2,x),a
 225                     ; 108 }
 228  0039 81            	ret	
 254                     ; 122 void TSL_SCKey_SetPreDetectState(void)
 254                     ; 123 {
 255                     	switch	.text
 256  003a               _TSL_SCKey_SetPreDetectState:
 260                     ; 124   pKeyStruct->State.whole = PRE_DETECTED_STATE;
 262  003a a614          	ld	a,#20
 263  003c 92c700        	ld	[_pKeyStruct.w],a
 264                     ; 125   pKeyStruct->Channel.IntegratorCounter = DetectionIntegrator;
 266  003f be00          	ldw	x,_pKeyStruct
 267  0041 b600          	ld	a,_DetectionIntegrator
 268  0043 e70a          	ld	(10,x),a
 269                     ; 126 }
 272  0045 81            	ret	
 298                     ; 140 void TSL_SCKey_SetDetectedState(void)
 298                     ; 141 {
 299                     	switch	.text
 300  0046               _TSL_SCKey_SetDetectedState:
 304                     ; 142   pKeyStruct->State.whole = DETECTED_STATE;
 306  0046 a604          	ld	a,#4
 307  0048 92c700        	ld	[_pKeyStruct.w],a
 308                     ; 143   pKeyStruct->Setting.b.DETECTED = 1;
 310  004b be00          	ldw	x,_pKeyStruct
 311  004d e602          	ld	a,(2,x)
 312                     ; 144   pKeyStruct->Setting.b.CHANGED = 1;
 314  004f aa0c          	or	a,#12
 315  0051 e702          	ld	(2,x),a
 316                     ; 145   pKeyStruct->Counter = DetectionTimeout;
 318  0053 b600          	ld	a,_DetectionTimeout
 319  0055 e703          	ld	(3,x),a
 320                     ; 146 }
 323  0057 81            	ret	
 349                     ; 160 void TSL_SCKey_SetPostDetectState(void)
 349                     ; 161 {
 350                     	switch	.text
 351  0058               _TSL_SCKey_SetPostDetectState:
 355                     ; 162   pKeyStruct->State.whole = POST_DETECTED_STATE;
 357  0058 a624          	ld	a,#36
 358  005a 92c700        	ld	[_pKeyStruct.w],a
 359                     ; 163   pKeyStruct->Channel.IntegratorCounter = EndDetectionIntegrator;
 361  005d be00          	ldw	x,_pKeyStruct
 362  005f b600          	ld	a,_EndDetectionIntegrator
 363  0061 e70a          	ld	(10,x),a
 364                     ; 164 }
 367  0063 81            	ret	
 392                     ; 178 void TSL_SCKey_BackToDetectedState(void)
 392                     ; 179 {
 393                     	switch	.text
 394  0064               _TSL_SCKey_BackToDetectedState:
 398                     ; 180   pKeyStruct->State.whole = DETECTED_STATE;
 400  0064 a604          	ld	a,#4
 401  0066 92c700        	ld	[_pKeyStruct.w],a
 402                     ; 181 }
 405  0069 81            	ret	
 431                     ; 195 void TSL_SCKey_SetPreRecalibrationState(void)
 431                     ; 196 {
 432                     	switch	.text
 433  006a               _TSL_SCKey_SetPreRecalibrationState:
 437                     ; 197   pKeyStruct->State.whole = PRE_CALIBRATION_STATE;
 439  006a a611          	ld	a,#17
 440  006c 92c700        	ld	[_pKeyStruct.w],a
 441                     ; 198   pKeyStruct->Channel.IntegratorCounter = RecalibrationIntegrator;
 443  006f be00          	ldw	x,_pKeyStruct
 444  0071 b600          	ld	a,_RecalibrationIntegrator
 445  0073 e70a          	ld	(10,x),a
 446                     ; 199 }
 449  0075 81            	ret	
 474                     ; 213 void TSL_SCKey_SetCalibrationState(void)
 474                     ; 214 {
 475                     	switch	.text
 476  0076               _TSL_SCKey_SetCalibrationState:
 480                     ; 215   pKeyStruct->State.whole = CALIBRATION_STATE;
 482  0076 a601          	ld	a,#1
 483  0078 92c700        	ld	[_pKeyStruct.w],a
 484                     ; 216   pKeyStruct->Setting.b.DETECTED = 0;
 486  007b be00          	ldw	x,_pKeyStruct
 487  007d e602          	ld	a,(2,x)
 488                     ; 217   pKeyStruct->Setting.b.CHANGED = 1;
 490  007f a45b          	and	a,#91
 491  0081 aa08          	or	a,#8
 492                     ; 218   pKeyStruct->Setting.b.LOCKED = 0;
 494                     ; 219   pKeyStruct->Setting.b.ERROR = 0;
 496  0083 e702          	ld	(2,x),a
 497                     ; 220   pKeyStruct->Counter = SCKEY_CALIBRATION_COUNT_DEFAULT;
 499  0085 a608          	ld	a,#8
 500  0087 e703          	ld	(3,x),a
 501                     ; 221   pKeyStruct->Channel.Reference = 0;
 503  0089 905f          	clrw	y
 504  008b ef08          	ldw	(8,x),y
 505                     ; 222 }
 508  008d 81            	ret	
 533                     ; 236 void TSL_SCKey_SetErrorState(void)
 533                     ; 237 {
 534                     	switch	.text
 535  008e               _TSL_SCKey_SetErrorState:
 539                     ; 238   pKeyStruct->State.whole = ERROR_STATE;
 541  008e a608          	ld	a,#8
 542  0090 92c700        	ld	[_pKeyStruct.w],a
 543                     ; 239   pKeyStruct->Setting.b.DETECTED = 0;
 545  0093 be00          	ldw	x,_pKeyStruct
 546  0095 e602          	ld	a,(2,x)
 547                     ; 240   pKeyStruct->Setting.b.CHANGED = 1;
 549  0097 a47b          	and	a,#123
 550                     ; 241   pKeyStruct->Setting.b.LOCKED = 0;
 552                     ; 242   pKeyStruct->Setting.b.ERROR = 1;
 554  0099 aa28          	or	a,#40
 555  009b e702          	ld	(2,x),a
 556                     ; 243 }
 559  009d 81            	ret	
 584                     ; 257 void TSL_SCKey_SetDisabledState(void)
 584                     ; 258 {
 585                     	switch	.text
 586  009e               _TSL_SCKey_SetDisabledState:
 590                     ; 259   pKeyStruct->State.whole = DISABLED_STATE;
 592  009e a680          	ld	a,#128
 593  00a0 92c700        	ld	[_pKeyStruct.w],a
 594                     ; 260   pKeyStruct->Setting.b.DETECTED = 0;
 596  00a3 be00          	ldw	x,_pKeyStruct
 597  00a5 e602          	ld	a,(2,x)
 598                     ; 261   pKeyStruct->Setting.b.CHANGED = 1;
 600  00a7 a45b          	and	a,#91
 601  00a9 aa08          	or	a,#8
 602                     ; 262   pKeyStruct->Setting.b.LOCKED = 0;
 604                     ; 263   pKeyStruct->Setting.b.ERROR = 0;
 606  00ab e702          	ld	(2,x),a
 607                     ; 264 }
 610  00ad 81            	ret	
 697                     ; 280 void TSL_ECS(void)
 697                     ; 281 {
 698                     	switch	.text
 699  00ae               _TSL_ECS:
 701  00ae 520b          	subw	sp,#11
 702       0000000b      OFST:	set	11
 705                     ; 287   disableInterrupts();
 708  00b0 9b            	sim	
 710                     ; 288   Local_TickECS10ms = TSL_TickCount_ECS_10ms;
 713  00b1 450000        	mov	_Local_TickECS10ms,_TSL_TickCount_ECS_10ms
 714                     ; 289   TSL_TickCount_ECS_10ms = 0;
 716  00b4 3f00          	clr	_TSL_TickCount_ECS_10ms
 717                     ; 290   enableInterrupts();
 720  00b6 9a            	rim	
 724  00b7 cc0196        	jra	L522
 725  00ba               L322:
 726                     ; 294     ECSTimeStepCounter--;
 728  00ba 3a00          	dec	_ECSTimeStepCounter
 729                     ; 295     ECSTempoPrescaler--;
 731  00bc 3a00          	dec	_ECSTempoPrescaler
 732                     ; 296     if ( !ECSTempoPrescaler )
 734  00be 260a          	jrne	L132
 735                     ; 298       ECSTempoPrescaler = 10;
 737  00c0 350a0000      	mov	_ECSTempoPrescaler,#10
 738                     ; 299       if ( ECSTempoCounter )
 740  00c4 b600          	ld	a,_ECSTempoCounter
 741  00c6 2702          	jreq	L132
 742                     ; 300         ECSTempoCounter--;
 744  00c8 3a00          	dec	_ECSTempoCounter
 745  00ca               L132:
 746                     ; 303     K_Filter = ECS_K_Slow;   // Default case !
 748  00ca b600          	ld	a,_ECS_K_Slow
 749  00cc 6b05          	ld	(OFST-6,sp),a
 750                     ; 304     ECS_Fast_Enable = 1;
 752  00ce a601          	ld	a,#1
 753  00d0 6b07          	ld	(OFST-4,sp),a
 754                     ; 305     ECS_Fast_Direction = 0;
 756  00d2 0f06          	clr	(OFST-5,sp)
 757                     ; 306     for ( KeyIndex = 0; KeyIndex < NUMBER_OF_SINGLE_CHANNEL_KEYS; KeyIndex++ )
 759  00d4 3f00          	clr	_KeyIndex
 760  00d6               L532:
 761                     ; 308       TSL_SetStructPointer();
 763  00d6 cd0000        	call	_TSL_SetStructPointer
 765                     ; 310       if ( pKeyStruct->State.whole & (PRE_DETECTED_STATE | DETECTED_STATE | POST_DETECTED_STATE) )
 767  00d9 92c600        	ld	a,[_pKeyStruct.w]
 768  00dc a534          	bcp	a,#52
 769  00de 2705          	jreq	L342
 770                     ; 312         ECSTempoCounter = ECSTemporization;    // Restart temporization counter ...
 772  00e0 450000        	mov	_ECSTempoCounter,_ECSTemporization
 773                     ; 313         break;           // Out from the for loop
 775  00e3 202a          	jra	L142
 776  00e5               L342:
 777                     ; 315       if ( pKeyStruct->State.whole == IDLE_STATE )
 779  00e5 a102          	cp	a,#2
 780  00e7 261e          	jrne	L542
 781                     ; 317         TSL_DeltaCalculation();

⌨️ 快捷键说明

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