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

📄 stm8_tsl_multichannelkey.ls

📁 STM8s
💻 LS
📖 第 1 页 / 共 5 页
字号:
 506  0127 a4f7          	and	a,#247
 507  0129 e702          	ld	(2,x),a
 508                     ; 1115   pMCKeyStruct->Setting.b.POSCHANGED = 0;
 510  012b be00          	ldw	x,_pMCKeyStruct
 511  012d e602          	ld	a,(2,x)
 512  012f a4ef          	and	a,#239
 513  0131 e702          	ld	(2,x),a
 514                     ; 1117 }
 517  0133 81            	ret
 549                     ; 1130 void TSL_MCKey_IdleTreatment(void)
 549                     ; 1131 {
 550                     	switch	.text
 551  0134               _TSL_MCKey_IdleTreatment:
 555                     ; 1134   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
 557  0134 3f00          	clr	_ChannelIndex
 558  0136               L341:
 559                     ; 1139     if (pMCKeyStruct->Channel[ChannelIndex].LastMeasRejectNb > MAX_REJECTED_MEASUREMENTS)
 561  0136 b600          	ld	a,_ChannelIndex
 562  0138 97            	ld	xl,a
 563  0139 a607          	ld	a,#7
 564  013b 42            	mul	x,a
 565  013c 72bb0000      	addw	x,_pMCKeyStruct
 566  0140 6d07          	tnz	(7,x)
 567  0142 2620          	jrne	L741
 568                     ; 1141       break;
 570                     ; 1145     TSL_MCKey_DeltaCalculation(ChannelIndex);
 572  0144 b600          	ld	a,_ChannelIndex
 573  0146 cd0000        	call	_TSL_MCKey_DeltaCalculation
 575                     ; 1148     if (Delta <= pMCKeyStruct->RecalibrationThreshold)
 577  0149 9c            	rvf
 578  014a be00          	ldw	x,_pMCKeyStruct
 579  014c e62c          	ld	a,(44,x)
 580  014e 5f            	clrw	x
 581  014f 4d            	tnz	a
 582  0150 2a01          	jrpl	L02
 583  0152 53            	cplw	x
 584  0153               L02:
 585  0153 97            	ld	xl,a
 586  0154 b300          	cpw	x,_Delta
 587  0156 2f04          	jrslt	L351
 588                     ; 1150       TSL_MCKey_SetPreRecalibrationState();
 590  0158 cd0000        	call	_TSL_MCKey_SetPreRecalibrationState
 592                     ; 1151       return;
 595  015b 81            	ret
 596  015c               L351:
 597                     ; 1134   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
 599  015c 3c00          	inc	_ChannelIndex
 602  015e b600          	ld	a,_ChannelIndex
 603  0160 a105          	cp	a,#5
 604  0162 25d2          	jrult	L341
 605  0164               L741:
 606                     ; 1158   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
 608  0164 3f00          	clr	_ChannelIndex
 609  0166               L551:
 610                     ; 1163     if (pMCKeyStruct->Channel[ChannelIndex].LastMeasRejectNb > MAX_REJECTED_MEASUREMENTS)
 612  0166 b600          	ld	a,_ChannelIndex
 613  0168 97            	ld	xl,a
 614  0169 a607          	ld	a,#7
 615  016b 42            	mul	x,a
 616  016c 72bb0000      	addw	x,_pMCKeyStruct
 617  0170 6d07          	tnz	(7,x)
 618  0172 262a          	jrne	L161
 619                     ; 1165       break;
 621                     ; 1169     TSL_MCKey_DeltaCalculation(ChannelIndex);
 623  0174 b600          	ld	a,_ChannelIndex
 624  0176 cd0000        	call	_TSL_MCKey_DeltaCalculation
 626                     ; 1172     if (Delta >= pMCKeyStruct->DetectThreshold)
 628  0179 9c            	rvf
 629  017a be00          	ldw	x,_pMCKeyStruct
 630  017c e62a          	ld	a,(42,x)
 631  017e 5f            	clrw	x
 632  017f 4d            	tnz	a
 633  0180 2a01          	jrpl	L22
 634  0182 53            	cplw	x
 635  0183               L22:
 636  0183 97            	ld	xl,a
 637  0184 b300          	cpw	x,_Delta
 638  0186 2c0e          	jrsgt	L561
 639                     ; 1177       TSL_MCKey_SetPreDetectState();
 641  0188 cd0000        	call	_TSL_MCKey_SetPreDetectState
 643                     ; 1178       if (!DetectionIntegrator)
 645  018b 3d00          	tnz	_DetectionIntegrator
 646  018d 2606          	jrne	L761
 647                     ; 1180         pMCKeyStruct->Channel[0].IntegratorCounter++;
 649  018f be00          	ldw	x,_pMCKeyStruct
 650  0191 6c0a          	inc	(10,x)
 651                     ; 1181         TSL_MCKey_PreDetectTreatment();
 653  0193 ad0a          	call	_TSL_MCKey_PreDetectTreatment
 655  0195               L761:
 656                     ; 1183       return;
 659  0195 81            	ret
 660  0196               L561:
 661                     ; 1158   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
 663  0196 3c00          	inc	_ChannelIndex
 666  0198 b600          	ld	a,_ChannelIndex
 667  019a a105          	cp	a,#5
 668  019c 25c8          	jrult	L551
 669  019e               L161:
 670                     ; 1188 }
 673  019e 81            	ret
 717                     ; 1201 void TSL_MCKey_PreDetectTreatment(void)
 717                     ; 1202 {
 718                     	switch	.text
 719  019f               _TSL_MCKey_PreDetectTreatment:
 721  019f 88            	push	a
 722       00000001      OFST:	set	1
 725                     ; 1204   u8 ConditionLeaveDetect = 1; /* Per default we go back to idle state */
 727  01a0 a601          	ld	a,#1
 728  01a2 6b01          	ld	(OFST+0,sp),a
 729                     ; 1207   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
 731  01a4 3f00          	clr	_ChannelIndex
 732  01a6               L702:
 733                     ; 1209     TSL_MCKey_DeltaCalculation(ChannelIndex);
 735  01a6 b600          	ld	a,_ChannelIndex
 736  01a8 cd0000        	call	_TSL_MCKey_DeltaCalculation
 738                     ; 1212     if ((pMCKeyStruct->Channel[ChannelIndex].LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS) &&
 738                     ; 1213         (Delta >= pMCKeyStruct->DetectThreshold))
 740  01ab b600          	ld	a,_ChannelIndex
 741  01ad 97            	ld	xl,a
 742  01ae a607          	ld	a,#7
 743  01b0 42            	mul	x,a
 744  01b1 72bb0000      	addw	x,_pMCKeyStruct
 745  01b5 6d07          	tnz	(7,x)
 746  01b7 2613          	jrne	L512
 748  01b9 9c            	rvf
 749  01ba be00          	ldw	x,_pMCKeyStruct
 750  01bc e62a          	ld	a,(42,x)
 751  01be 5f            	clrw	x
 752  01bf 4d            	tnz	a
 753  01c0 2a01          	jrpl	L62
 754  01c2 53            	cplw	x
 755  01c3               L62:
 756  01c3 97            	ld	xl,a
 757  01c4 b300          	cpw	x,_Delta
 758  01c6 2c04          	jrsgt	L512
 759                     ; 1226       ConditionLeaveDetect = 0;
 761  01c8 0f01          	clr	(OFST+0,sp)
 762                     ; 1227       break;
 764  01ca 2008          	jra	L312
 765  01cc               L512:
 766                     ; 1207   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
 768  01cc 3c00          	inc	_ChannelIndex
 771  01ce b600          	ld	a,_ChannelIndex
 772  01d0 a105          	cp	a,#5
 773  01d2 25d2          	jrult	L702
 774  01d4               L312:
 775                     ; 1231   if (ConditionLeaveDetect)
 777  01d4 0d01          	tnz	(OFST+0,sp)
 778  01d6 2705          	jreq	L712
 779                     ; 1233     TSL_MCKey_BackToIdleState();
 781  01d8 cd0000        	call	_TSL_MCKey_BackToIdleState
 783                     ; 1234     return;
 786  01db 84            	pop	a
 787  01dc 81            	ret
 788  01dd               L712:
 789                     ; 1238     TSL_MCKey_DxS();
 791  01dd cd0000        	call	_TSL_MCKey_DxS
 793                     ; 1239     pMCKeyStruct->Channel[0].IntegratorCounter--;
 795  01e0 be00          	ldw	x,_pMCKeyStruct
 796  01e2 6a0a          	dec	(10,x)
 797                     ; 1240     if (!pMCKeyStruct->Channel[0].IntegratorCounter)
 799  01e4 be00          	ldw	x,_pMCKeyStruct
 800  01e6 6d0a          	tnz	(10,x)
 801  01e8 2606          	jrne	L122
 802                     ; 1242       TSL_MCKey_Position();
 804  01ea cd034a        	call	_TSL_MCKey_Position
 806                     ; 1243       TSL_MCKey_SetDetectedState();
 808  01ed cd0000        	call	_TSL_MCKey_SetDetectedState
 810  01f0               L122:
 811                     ; 1247 }
 814  01f0 84            	pop	a
 815  01f1 81            	ret
 860                     ; 1261 void TSL_MCKey_DetectedTreatment(void)
 860                     ; 1262 {
 861                     	switch	.text
 862  01f2               _TSL_MCKey_DetectedTreatment:
 864  01f2 88            	push	a
 865       00000001      OFST:	set	1
 868                     ; 1264   u8 ConditionLeaveDetect = 1;
 870  01f3 a601          	ld	a,#1
 871  01f5 6b01          	ld	(OFST+0,sp),a
 872                     ; 1267   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
 874  01f7 3f00          	clr	_ChannelIndex
 875  01f9               L342:
 876                     ; 1269     TSL_MCKey_DeltaCalculation(ChannelIndex);
 878  01f9 b600          	ld	a,_ChannelIndex
 879  01fb cd0000        	call	_TSL_MCKey_DeltaCalculation
 881                     ; 1272     if ((pMCKeyStruct->Channel[ChannelIndex].LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS) &&
 881                     ; 1273         (Delta > pMCKeyStruct->EndDetectThreshold))
 883  01fe b600          	ld	a,_ChannelIndex
 884  0200 97            	ld	xl,a
 885  0201 a607          	ld	a,#7
 886  0203 42            	mul	x,a
 887  0204 72bb0000      	addw	x,_pMCKeyStruct
 888  0208 6d07          	tnz	(7,x)
 889  020a 2613          	jrne	L152
 891  020c 9c            	rvf
 892  020d be00          	ldw	x,_pMCKeyStruct
 893  020f e62b          	ld	a,(43,x)
 894  0211 5f            	clrw	x
 895  0212 4d            	tnz	a
 896  0213 2a01          	jrpl	L23
 897  0215 53            	cplw	x
 898  0216               L23:
 899  0216 97            	ld	xl,a
 900  0217 b300          	cpw	x,_Delta
 901  0219 2e04          	jrsge	L152
 902                     ; 1288       ConditionLeaveDetect = 0;
 904  021b 0f01          	clr	(OFST+0,sp)
 905                     ; 1289       break;
 907  021d 2008          	jra	L742
 908  021f               L152:
 909                     ; 1267   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
 911  021f 3c00          	inc	_ChannelIndex
 914  0221 b600          	ld	a,_ChannelIndex
 915  0223 a105          	cp	a,#5
 916  0225 25d2          	jrult	L342
 917  0227               L742:
 918                     ; 1293   if (ConditionLeaveDetect)
 920  0227 0d01          	tnz	(OFST+0,sp)
 921  0229 270f          	jreq	L352
 922                     ; 1295     TSL_MCKey_SetPostDetectState();
 924  022b cd0000        	call	_TSL_MCKey_SetPostDetectState
 926                     ; 1296     if (!EndDetectionIntegrator)
 928  022e 3d00          	tnz	_EndDetectionIntegrator
 929  0230 2606          	jrne	L552
 930                     ; 1298       pMCKeyStruct->Channel[0].IntegratorCounter++;
 932  0232 be00          	ldw	x,_pMCKeyStruct
 933  0234 6c0a          	inc	(10,x)
 934                     ; 1299       TSL_MCKey_PostDetectTreatment();
 936  0236 ad0d          	call	_TSL_MCKey_PostDetectTreatment
 938  0238               L552:
 939                     ; 1301     return;
 942  0238 84            	pop	a
 943  0239 81            	ret
 944  023a               L352:
 945                     ; 1305   if (TSL_MCKey_Position() == 0x00)
 947  023a cd034a        	call	_TSL_MCKey_Position
 949  023d 4d            	tnz	a
 950  023e 2603          	jrne	L752
 951                     ; 1307     TSL_MCKey_DetectionTimeout();
 953  0240 cd0000        	call	_TSL_MCKey_DetectionTimeout
 955  0243               L752:
 956                     ; 1310 }
 959  0243 84            	pop	a
 960  0244 81            	ret
1002                     ; 1323 void TSL_MCKey_PostDetectTreatment(void)
1002                     ; 1324 {
1003                     	switch	.text
1004  0245               _TSL_MCKey_PostDetectTreatment:
1006  0245 88            	push	a
1007       00000001      OFST:	set	1
1010                     ; 1326   u8 ConditionLeaveDetect = 1;
1012  0246 a601          	ld	a,#1
1013  0248 6b01          	ld	(OFST+0,sp),a
1014                     ; 1329   for (ChannelIndex = 0; ChannelIndex < CHANNEL_PER_MCKEY; ChannelIndex++)
1016  024a 3f00          	clr	_ChannelIndex
1017  024c               L772:
1018                     ; 1331     TSL_MCKey_DeltaCalculation(ChannelIndex);
1020  024c b600          	ld	a,_ChannelIndex
1021  024e cd0000        	call	_TSL_MCKey_DeltaCalculation
1023                     ; 1334     if ((pMCKeyStruct->Channel[ChannelIndex].LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS) &&
1023                     ; 1335         (Delta > pMCKeyStruct->EndDetectThreshold))
1025  0251 b600          	ld	a,_ChannelIndex
1026  0253 97            	ld	xl,a
1027  0254 a607          	ld	a,#7
1028  0256 42            	mul	x,a
1029  0257 72bb0000      	addw	x,_pMCKeyStruct
1030  025b 6d07          	tnz	(7,x)
1031  025d 2613          	jrne	L503
1033  025f 9c            	rvf
1034  0260 be00          	ldw	x,_pMCKeyStruct

⌨️ 快捷键说明

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