📄 stm8_tsl_rc_services.ls
字号:
1 ; C Compiler for STM8 (COSMIC Software)
2 ; Parser V4.8.32.1 - 30 Mar 2010
3 ; Generator V4.3.4 - 23 Mar 2010
81 ; 51 void TSL_SetStructPointer(void)
81 ; 52 {
83 switch .text
84 0000 _TSL_SetStructPointer:
88 ; 53 pKeyStruct = &sSCKeyInfo[KeyIndex];
90 0000 b600 ld a,_KeyIndex
91 0002 97 ld xl,a
92 0003 a60f ld a,#15
93 0005 42 mul x,a
94 0006 1c0000 addw x,#_sSCKeyInfo
95 0009 bf00 ldw _pKeyStruct,x
96 ; 54 }
99 000b 81 ret
125 ; 67 void TSL_DeltaCalculation(void)
125 ; 68 {
126 switch .text
127 000c _TSL_DeltaCalculation:
131 ; 69 Delta = (s16)(pKeyStruct->Channel.LastMeas - pKeyStruct->Channel.Reference);
133 000c be00 ldw x,_pKeyStruct
134 000e ee05 ldw x,(5,x)
135 0010 90be00 ldw y,_pKeyStruct
136 0013 90ee08 ldw y,(8,y)
137 0016 90bf00 ldw c_x,y
138 0019 72b00000 subw x,c_x
139 001d bf00 ldw _Delta,x
140 ; 70 }
143 001f 81 ret
169 ; 84 void TSL_SCKey_SetIdleState(void)
169 ; 85 {
170 switch .text
171 0020 _TSL_SCKey_SetIdleState:
175 ; 86 pKeyStruct->Setting.b.CHANGED = 1;
177 0020 be00 ldw x,_pKeyStruct
178 0022 e602 ld a,(2,x)
179 0024 aa08 or a,#8
180 0026 e702 ld (2,x),a
181 ; 87 TSL_SCKey_BackToIdleState();
183 0028 ad01 call _TSL_SCKey_BackToIdleState
185 ; 88 }
188 002a 81 ret
213 ; 102 void TSL_SCKey_BackToIdleState(void)
213 ; 103 {
214 switch .text
215 002b _TSL_SCKey_BackToIdleState:
219 ; 104 pKeyStruct->State.whole = IDLE_STATE;
221 002b a602 ld a,#2
222 002d 92c700 ld [_pKeyStruct.w],a
223 ; 105 pKeyStruct->Setting.b.DETECTED = 0;
225 0030 be00 ldw x,_pKeyStruct
226 0032 e602 ld a,(2,x)
227 0034 a4fb and a,#251
228 0036 e702 ld (2,x),a
229 ; 106 pKeyStruct->Setting.b.LOCKED = 0;
231 0038 be00 ldw x,_pKeyStruct
232 003a e602 ld a,(2,x)
233 003c a47f and a,#127
234 003e e702 ld (2,x),a
235 ; 107 pKeyStruct->Setting.b.ERROR = 0;
237 0040 be00 ldw x,_pKeyStruct
238 0042 e602 ld a,(2,x)
239 0044 a4df and a,#223
240 0046 e702 ld (2,x),a
241 ; 108 }
244 0048 81 ret
270 ; 122 void TSL_SCKey_SetPreDetectState(void)
270 ; 123 {
271 switch .text
272 0049 _TSL_SCKey_SetPreDetectState:
276 ; 124 pKeyStruct->State.whole = PRE_DETECTED_STATE;
278 0049 a614 ld a,#20
279 004b 92c700 ld [_pKeyStruct.w],a
280 ; 125 pKeyStruct->Channel.IntegratorCounter = DetectionIntegrator;
282 004e be00 ldw x,_pKeyStruct
283 0050 c60000 ld a,_DetectionIntegrator
284 0053 e70a ld (10,x),a
285 ; 126 }
288 0055 81 ret
314 ; 140 void TSL_SCKey_SetDetectedState(void)
314 ; 141 {
315 switch .text
316 0056 _TSL_SCKey_SetDetectedState:
320 ; 142 pKeyStruct->State.whole = DETECTED_STATE;
322 0056 a604 ld a,#4
323 0058 92c700 ld [_pKeyStruct.w],a
324 ; 143 pKeyStruct->Setting.b.DETECTED = 1;
326 005b be00 ldw x,_pKeyStruct
327 005d e602 ld a,(2,x)
328 005f aa04 or a,#4
329 0061 e702 ld (2,x),a
330 ; 144 pKeyStruct->Setting.b.CHANGED = 1;
332 0063 be00 ldw x,_pKeyStruct
333 0065 e602 ld a,(2,x)
334 0067 aa08 or a,#8
335 0069 e702 ld (2,x),a
336 ; 145 pKeyStruct->Counter = DetectionTimeout;
338 006b be00 ldw x,_pKeyStruct
339 006d c60000 ld a,_DetectionTimeout
340 0070 e703 ld (3,x),a
341 ; 146 }
344 0072 81 ret
370 ; 160 void TSL_SCKey_SetPostDetectState(void)
370 ; 161 {
371 switch .text
372 0073 _TSL_SCKey_SetPostDetectState:
376 ; 162 pKeyStruct->State.whole = POST_DETECTED_STATE;
378 0073 a624 ld a,#36
379 0075 92c700 ld [_pKeyStruct.w],a
380 ; 163 pKeyStruct->Channel.IntegratorCounter = EndDetectionIntegrator;
382 0078 be00 ldw x,_pKeyStruct
383 007a c60000 ld a,_EndDetectionIntegrator
384 007d e70a ld (10,x),a
385 ; 164 }
388 007f 81 ret
413 ; 178 void TSL_SCKey_BackToDetectedState(void)
413 ; 179 {
414 switch .text
415 0080 _TSL_SCKey_BackToDetectedState:
419 ; 180 pKeyStruct->State.whole = DETECTED_STATE;
421 0080 a604 ld a,#4
422 0082 92c700 ld [_pKeyStruct.w],a
423 ; 181 }
426 0085 81 ret
452 ; 195 void TSL_SCKey_SetPreRecalibrationState(void)
452 ; 196 {
453 switch .text
454 0086 _TSL_SCKey_SetPreRecalibrationState:
458 ; 197 pKeyStruct->State.whole = PRE_CALIBRATION_STATE;
460 0086 a611 ld a,#17
461 0088 92c700 ld [_pKeyStruct.w],a
462 ; 198 pKeyStruct->Channel.IntegratorCounter = RecalibrationIntegrator;
464 008b be00 ldw x,_pKeyStruct
465 008d c60000 ld a,_RecalibrationIntegrator
466 0090 e70a ld (10,x),a
467 ; 199 }
470 0092 81 ret
495 ; 213 void TSL_SCKey_SetCalibrationState(void)
495 ; 214 {
496 switch .text
497 0093 _TSL_SCKey_SetCalibrationState:
501 ; 215 pKeyStruct->State.whole = CALIBRATION_STATE;
503 0093 a601 ld a,#1
504 0095 92c700 ld [_pKeyStruct.w],a
505 ; 216 pKeyStruct->Setting.b.DETECTED = 0;
507 0098 be00 ldw x,_pKeyStruct
508 009a e602 ld a,(2,x)
509 009c a4fb and a,#251
510 009e e702 ld (2,x),a
511 ; 217 pKeyStruct->Setting.b.CHANGED = 1;
513 00a0 be00 ldw x,_pKeyStruct
514 00a2 e602 ld a,(2,x)
515 00a4 aa08 or a,#8
516 00a6 e702 ld (2,x),a
517 ; 218 pKeyStruct->Setting.b.LOCKED = 0;
519 00a8 be00 ldw x,_pKeyStruct
520 00aa e602 ld a,(2,x)
521 00ac a47f and a,#127
522 00ae e702 ld (2,x),a
523 ; 219 pKeyStruct->Setting.b.ERROR = 0;
525 00b0 be00 ldw x,_pKeyStruct
526 00b2 e602 ld a,(2,x)
527 00b4 a4df and a,#223
528 00b6 e702 ld (2,x),a
529 ; 220 pKeyStruct->Counter = SCKEY_CALIBRATION_COUNT_DEFAULT;
531 00b8 be00 ldw x,_pKeyStruct
532 00ba a608 ld a,#8
533 00bc e703 ld (3,x),a
534 ; 221 pKeyStruct->Channel.Reference = 0;
536 00be be00 ldw x,_pKeyStruct
537 00c0 905f clrw y
538 00c2 ef08 ldw (8,x),y
539 ; 222 }
542 00c4 81 ret
567 ; 236 void TSL_SCKey_SetErrorState(void)
567 ; 237 {
568 switch .text
569 00c5 _TSL_SCKey_SetErrorState:
573 ; 238 pKeyStruct->State.whole = ERROR_STATE;
575 00c5 a608 ld a,#8
576 00c7 92c700 ld [_pKeyStruct.w],a
577 ; 239 pKeyStruct->Setting.b.DETECTED = 0;
579 00ca be00 ldw x,_pKeyStruct
580 00cc e602 ld a,(2,x)
581 00ce a4fb and a,#251
582 00d0 e702 ld (2,x),a
583 ; 240 pKeyStruct->Setting.b.CHANGED = 1;
585 00d2 be00 ldw x,_pKeyStruct
586 00d4 e602 ld a,(2,x)
587 00d6 aa08 or a,#8
588 00d8 e702 ld (2,x),a
589 ; 241 pKeyStruct->Setting.b.LOCKED = 0;
591 00da be00 ldw x,_pKeyStruct
592 00dc e602 ld a,(2,x)
593 00de a47f and a,#127
594 00e0 e702 ld (2,x),a
595 ; 242 pKeyStruct->Setting.b.ERROR = 1;
597 00e2 be00 ldw x,_pKeyStruct
598 00e4 e602 ld a,(2,x)
599 00e6 aa20 or a,#32
600 00e8 e702 ld (2,x),a
601 ; 243 }
604 00ea 81 ret
629 ; 257 void TSL_SCKey_SetDisabledState(void)
629 ; 258 {
630 switch .text
631 00eb _TSL_SCKey_SetDisabledState:
635 ; 259 pKeyStruct->State.whole = DISABLED_STATE;
637 00eb a680 ld a,#128
638 00ed 92c700 ld [_pKeyStruct.w],a
639 ; 260 pKeyStruct->Setting.b.DETECTED = 0;
641 00f0 be00 ldw x,_pKeyStruct
642 00f2 e602 ld a,(2,x)
643 00f4 a4fb and a,#251
644 00f6 e702 ld (2,x),a
645 ; 261 pKeyStruct->Setting.b.CHANGED = 1;
647 00f8 be00 ldw x,_pKeyStruct
648 00fa e602 ld a,(2,x)
649 00fc aa08 or a,#8
650 00fe e702 ld (2,x),a
651 ; 262 pKeyStruct->Setting.b.LOCKED = 0;
653 0100 be00 ldw x,_pKeyStruct
654 0102 e602 ld a,(2,x)
655 0104 a47f and a,#127
656 0106 e702 ld (2,x),a
657 ; 263 pKeyStruct->Setting.b.ERROR = 0;
659 0108 be00 ldw x,_pKeyStruct
660 010a e602 ld a,(2,x)
661 010c a4df and a,#223
662 010e e702 ld (2,x),a
663 ; 264 }
666 0110 81 ret
743 ; 280 void TSL_ECS(void)
743 ; 281 {
744 switch .text
745 0111 _TSL_ECS:
747 0111 520b subw sp,#11
748 0000000b OFST: set 11
751 ; 287 disableInterrupts();
754 0113 9b sim
756 ; 288 Local_TickECS10ms = TSL_TickCount_ECS_10ms;
759 0114 450000 mov _Local_TickECS10ms,_TSL_TickCount_ECS_10ms
760 ; 289 TSL_TickCount_ECS_10ms = 0;
762 0117 3f00 clr _TSL_TickCount_ECS_10ms
763 ; 290 enableInterrupts();
766 0119 9a rim
770 011a ac340234 jpf L312
771 011e L112:
772 ; 294 ECSTimeStepCounter--;
774 011e 3a00 dec _ECSTimeStepCounter
775 ; 295 ECSTempoPrescaler--;
777 0120 725a0000 dec _ECSTempoPrescaler
778 ; 296 if ( !ECSTempoPrescaler )
780 0124 725d0000 tnz _ECSTempoPrescaler
781 0128 260e jrne L712
782 ; 298 ECSTempoPrescaler = 10;
784 012a 350a0000 mov _ECSTempoPrescaler,#10
785 ; 299 if ( ECSTempoCounter )
787 012e 725d0000 tnz _ECSTempoCounter
788 0132 2704 jreq L712
789 ; 300 ECSTempoCounter--;
791 0134 725a0000 dec _ECSTempoCounter
792 0138 L712:
793 ; 303 K_Filter = ECS_K_Slow; // Default case !
795 0138 c60000 ld a,_ECS_K_Slow
796 013b 6b05 ld (OFST-6,sp),a
797 ; 304 ECS_Fast_Enable = 1;
799 013d a601 ld a,#1
800 013f 6b07 ld (OFST-4,sp),a
801 ; 305 ECS_Fast_Direction = 0;
803 0141 0f06 clr (OFST-5,sp)
804 ; 306 for ( KeyIndex = 0; KeyIndex < NUMBER_OF_SINGLE_CHANNEL_KEYS; KeyIndex++ )
806 0143 3f00 clr _KeyIndex
807 0145 L322:
808 ; 308 TSL_SetStructPointer();
810 0145 cd0000 call _TSL_SetStructPointer
812 ; 310 if ( pKeyStruct->State.whole & (PRE_DETECTED_STATE | DETECTED_STATE | POST_DETECTED_STATE) )
814 0148 92c600 ld a,[_pKeyStruct.w]
815 014b a534 bcp a,#52
816 014d 2707 jreq L132
817 ; 312 ECSTempoCounter = ECSTemporization; // Restart temporization counter ...
819 014f 5500000000 mov _ECSTempoCounter,_ECSTemporization
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -