   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Parser V4.8.32 - 23 Mar 2010
   3                     ; Generator V4.3.4 - 23 Mar 2010
  17                     .const:	section	.text
  18  0000               _LED7Code:
  19  0000 c0            	dc.b	192
  20  0001 f9            	dc.b	249
  21  0002 a4            	dc.b	164
  22  0003 b0            	dc.b	176
  23  0004 99            	dc.b	153
  24  0005 92            	dc.b	146
  25  0006 82            	dc.b	130
  26  0007 f8            	dc.b	248
  27  0008 80            	dc.b	128
  28  0009 90            	dc.b	144
  29  000a 88            	dc.b	136
  30  000b 83            	dc.b	131
  31  000c c6            	dc.b	198
  32  000d a1            	dc.b	161
  33  000e 86            	dc.b	134
  34  000f 8e            	dc.b	142
  35  0010 ff            	dc.b	255
  36                     	switch	.data
  37  0000               _SPIIO:
  38  0000 ff            	dc.b	255
  39  0001 ff            	dc.b	255
  40  0002 ff            	dc.b	255
  41  0003 00            	dc.b	0
  42  0004 ff            	dc.b	255
  85                     ; 36 void UpdateIO(void)
  85                     ; 37 {   
  87                     .text:	section	.text,new
  88  0000               _UpdateIO:
  90  0000 88            	push	a
  91       00000001      OFST:	set	1
  94                     ; 39 	GPIO_WriteLow(GPIOE, SPI_CS); 
  96  0001 4b20          	push	#32
  97  0003 ae5014        	ldw	x,#20500
  98  0006 cd0000        	call	_GPIO_WriteLow
 100  0009 84            	pop	a
 101                     ; 40 	for(i=0;i<sizeof(SPIIO.OutPort.Out);i++) 
 103  000a 0f01          	clr	(OFST+0,sp)
 104  000c               L52:
 105                     ; 41 		Translate(SPIIO.OutPort.Out[i]); 
 107  000c 7b01          	ld	a,(OFST+0,sp)
 108  000e 5f            	clrw	x
 109  000f 97            	ld	xl,a
 110  0010 d60000        	ld	a,(_SPIIO,x)
 111  0013 cd0000        	call	_Translate
 113                     ; 40 	for(i=0;i<sizeof(SPIIO.OutPort.Out);i++) 
 115  0016 0c01          	inc	(OFST+0,sp)
 118  0018 7b01          	ld	a,(OFST+0,sp)
 119  001a a104          	cp	a,#4
 120  001c 25ee          	jrult	L52
 121                     ; 43 	GPIO_WriteHigh(GPIOE, SPI_CS);  
 123  001e 4b20          	push	#32
 124  0020 ae5014        	ldw	x,#20500
 125  0023 cd0000        	call	_GPIO_WriteHigh
 127  0026 84            	pop	a
 128                     ; 44 	for(i=0;i<sizeof(SPIIO.InPort.In);i++)
 130  0027 0f01          	clr	(OFST+0,sp)
 131  0029               L33:
 132                     ; 45 		SPIIO.InPort.In[i]  = Receive(); 	
 134  0029 7b01          	ld	a,(OFST+0,sp)
 135  002b 5f            	clrw	x
 136  002c 97            	ld	xl,a
 137  002d 89            	pushw	x
 138  002e cd0000        	call	_Receive
 140  0031 85            	popw	x
 141  0032 d70004        	ld	(_SPIIO+4,x),a
 142                     ; 44 	for(i=0;i<sizeof(SPIIO.InPort.In);i++)
 144  0035 0c01          	inc	(OFST+0,sp)
 147  0037 0d01          	tnz	(OFST+0,sp)
 148  0039 27ee          	jreq	L33
 149                     ; 46 	GPIO_WriteLow(GPIOE, SPI_CS);
 151  003b 4b20          	push	#32
 152  003d ae5014        	ldw	x,#20500
 153  0040 cd0000        	call	_GPIO_WriteLow
 155  0043 84            	pop	a
 156                     ; 47 	for(i=0;i<sizeof(SPIIO.OutPort.Out);i++) 
 158  0044 0f01          	clr	(OFST+0,sp)
 159  0046               L14:
 160                     ; 48 		Translate(SPIIO.OutPort.Out[i]); 
 162  0046 7b01          	ld	a,(OFST+0,sp)
 163  0048 5f            	clrw	x
 164  0049 97            	ld	xl,a
 165  004a d60000        	ld	a,(_SPIIO,x)
 166  004d cd0000        	call	_Translate
 168                     ; 47 	for(i=0;i<sizeof(SPIIO.OutPort.Out);i++) 
 170  0050 0c01          	inc	(OFST+0,sp)
 173  0052 7b01          	ld	a,(OFST+0,sp)
 174  0054 a104          	cp	a,#4
 175  0056 25ee          	jrult	L14
 176                     ; 49 	GPIO_WriteHigh(GPIOE, SPI_CS);    
 178  0058 4b20          	push	#32
 179  005a ae5014        	ldw	x,#20500
 180  005d cd0000        	call	_GPIO_WriteHigh
 182  0060 84            	pop	a
 183                     ; 50 	GPIO_WriteLow(GPIOC, SPI_OE);	
 185  0061 4b10          	push	#16
 186  0063 ae500a        	ldw	x,#20490
 187  0066 cd0000        	call	_GPIO_WriteLow
 189  0069 84            	pop	a
 190                     ; 51 }
 193  006a 84            	pop	a
 194  006b 81            	ret
 197                     	switch	.data
 198  0005               L74_dispBit:
 199  0005 00            	dc.b	0
 233                     	switch	.const
 234  0011               L03:
 235  0011 000003e8      	dc.l	1000
 236  0015               L04:
 237  0015 00000064      	dc.l	100
 238                     ; 53 void Task_SEG7(void)
 238                     ; 54 { 
 239                     .text:	section	.text,new
 240  0000               _Task_SEG7:
 242  0000 5208          	subw	sp,#8
 243       00000008      OFST:	set	8
 246                     ; 56 	if(Debug_time==0)
 248  0002 725d0000      	tnz	_Debug_time
 249  0006 2663          	jrne	L56
 250                     ; 58 	dispBit = (++dispBit)%2;
 252  0008 725c0005      	inc	L74_dispBit
 253  000c c60005        	ld	a,L74_dispBit
 254  000f a401          	and	a,#1
 255  0011 c70005        	ld	L74_dispBit,a
 256                     ; 59 	SEG7 = dispBit?LED7Code[IED.nId/10==0?0x10:IED.nId/10]:LED7Code[IED.nId%10];
 258  0014 725d0005      	tnz	L74_dispBit
 259  0018 2723          	jreq	L01
 260  001a c6001d        	ld	a,_IED
 261  001d 5f            	clrw	x
 262  001e 97            	ld	xl,a
 263  001f a60a          	ld	a,#10
 264  0021 cd0000        	call	c_sdivx
 266  0024 a30000        	cpw	x,#0
 267  0027 2605          	jrne	L21
 268  0029 ae0010        	ldw	x,#16
 269  002c 200a          	jra	L41
 270  002e               L21:
 271  002e c6001d        	ld	a,_IED
 272  0031 5f            	clrw	x
 273  0032 97            	ld	xl,a
 274  0033 a60a          	ld	a,#10
 275  0035 cd0000        	call	c_sdivx
 277  0038               L41:
 278  0038 d60000        	ld	a,(_LED7Code,x)
 279  003b 200d          	jra	L61
 280  003d               L01:
 281  003d c6001d        	ld	a,_IED
 282  0040 5f            	clrw	x
 283  0041 97            	ld	xl,a
 284  0042 a60a          	ld	a,#10
 285  0044 cd0000        	call	c_smodx
 287  0047 d60000        	ld	a,(_LED7Code,x)
 288  004a               L61:
 289  004a c70001        	ld	_SPIIO+1,a
 290                     ; 60 	CSLED = 1<<dispBit; 
 292  004d c60005        	ld	a,L74_dispBit
 293  0050 5f            	clrw	x
 294  0051 97            	ld	xl,a
 295  0052 a601          	ld	a,#1
 296  0054 5d            	tnzw	x
 297  0055 2704          	jreq	L02
 298  0057               L22:
 299  0057 48            	sll	a
 300  0058 5a            	decw	x
 301  0059 26fc          	jrne	L22
 302  005b               L02:
 303  005b 4e            	swap	a
 304  005c c80003        	xor	a,_SPIIO+3
 305  005f a430          	and	a,#48
 306  0061 c80003        	xor	a,_SPIIO+3
 307  0064 c70003        	ld	_SPIIO+3,a
 309  0067 ac100110      	jpf	L76
 310  006b               L56:
 311                     ; 64 	dispBit = (++dispBit)%2;
 313  006b 725c0005      	inc	L74_dispBit
 314  006f c60005        	ld	a,L74_dispBit
 315  0072 a401          	and	a,#1
 316  0074 c70005        	ld	L74_dispBit,a
 317                     ; 65 	SEG7 = dispBit?LED7Code[(IED.MidTimeWait-10)/1000==0?0x10:(IED.MidTimeWait-10)/1000]:LED7Code[((IED.MidTimeWait-10)%1000)/100];
 319  0077 725d0005      	tnz	L74_dispBit
 320  007b 2748          	jreq	L42
 321  007d ae0000        	ldw	x,#_LED7Code
 322  0080 cd0000        	call	c_uitolx
 324  0083 96            	ldw	x,sp
 325  0084 1c0005        	addw	x,#OFST-3
 326  0087 cd0000        	call	c_rtol
 328  008a ae0031        	ldw	x,#_IED+20
 329  008d cd0000        	call	c_ltor
 331  0090 a60a          	ld	a,#10
 332  0092 cd0000        	call	c_lsbc
 334  0095 ae0011        	ldw	x,#L03
 335  0098 cd0000        	call	c_ldiv
 337  009b cd0000        	call	c_lrzmp
 339  009e 2608          	jrne	L23
 340  00a0 ae0010        	ldw	x,#16
 341  00a3 cd0000        	call	c_itolx
 343  00a6 2011          	jra	L43
 344  00a8               L23:
 345  00a8 ae0031        	ldw	x,#_IED+20
 346  00ab cd0000        	call	c_ltor
 348  00ae a60a          	ld	a,#10
 349  00b0 cd0000        	call	c_lsbc
 351  00b3 ae0011        	ldw	x,#L03
 352  00b6 cd0000        	call	c_ldiv
 354  00b9               L43:
 355  00b9 96            	ldw	x,sp
 356  00ba 1c0005        	addw	x,#OFST-3
 357  00bd cd0000        	call	c_ladd
 359  00c0 be02          	ldw	x,c_lreg+2
 360  00c2 f6            	ld	a,(x)
 361  00c3 202e          	jra	L63
 362  00c5               L42:
 363  00c5 ae0000        	ldw	x,#_LED7Code
 364  00c8 cd0000        	call	c_uitolx
 366  00cb 96            	ldw	x,sp
 367  00cc 1c0001        	addw	x,#OFST-7
 368  00cf cd0000        	call	c_rtol
 370  00d2 ae0031        	ldw	x,#_IED+20
 371  00d5 cd0000        	call	c_ltor
 373  00d8 a60a          	ld	a,#10
 374  00da cd0000        	call	c_lsbc
 376  00dd ae0011        	ldw	x,#L03
 377  00e0 cd0000        	call	c_lmod
 379  00e3 ae0015        	ldw	x,#L04
 380  00e6 cd0000        	call	c_ldiv
 382  00e9 96            	ldw	x,sp
 383  00ea 1c0001        	addw	x,#OFST-7
 384  00ed cd0000        	call	c_ladd
 386  00f0 be02          	ldw	x,c_lreg+2
 387  00f2 f6            	ld	a,(x)
 388  00f3               L63:
 389  00f3 c70001        	ld	_SPIIO+1,a
 390                     ; 66 	CSLED = 1<<dispBit; 
 392  00f6 c60005        	ld	a,L74_dispBit
 393  00f9 5f            	clrw	x
 394  00fa 97            	ld	xl,a
 395  00fb a601          	ld	a,#1
 396  00fd 5d            	tnzw	x
 397  00fe 2704          	jreq	L24
 398  0100               L44:
 399  0100 48            	sll	a
 400  0101 5a            	decw	x
 401  0102 26fc          	jrne	L44
 402  0104               L24:
 403  0104 4e            	swap	a
 404  0105 c80003        	xor	a,_SPIIO+3
 405  0108 a430          	and	a,#48
 406  010a c80003        	xor	a,_SPIIO+3
 407  010d c70003        	ld	_SPIIO+3,a
 408  0110               L76:
 409                     ; 68 }
 412  0110 5b08          	addw	sp,#8
 413  0112 81            	ret
 460                     ; 70 void Translate(unsigned char out)
 460                     ; 71 { 
 461                     .text:	section	.text,new
 462  0000               _Translate:
 464  0000 88            	push	a
 465  0001 88            	push	a
 466       00000001      OFST:	set	1
 469                     ; 73 	for(j=0;j<8;j++)
 471  0002 0f01          	clr	(OFST+0,sp)
 472  0004               L701:
 473                     ; 75 		GPIO_WriteLow(GPIOC, SPI_CLK);	 	
 475  0004 4b20          	push	#32
 476  0006 ae500a        	ldw	x,#20490
 477  0009 cd0000        	call	_GPIO_WriteLow
 479  000c 84            	pop	a
 480                     ; 76 		nop();nop();nop();	
 483  000d 9d            nop
 489  000e 9d            nop
 495  000f 9d            nop
 497                     ; 77 		if(out&0x80) 	 
 500  0010 7b02          	ld	a,(OFST+1,sp)
 501  0012 a580          	bcp	a,#128
 502  0014 270b          	jreq	L511
 503                     ; 79 			GPIO_WriteHigh(GPIOC, SPI_MOSI); 
 505  0016 4b40          	push	#64
 506  0018 ae500a        	ldw	x,#20490
 507  001b cd0000        	call	_GPIO_WriteHigh
 509  001e 84            	pop	a
 511  001f 2009          	jra	L711
 512  0021               L511:
 513                     ; 83 			GPIO_WriteLow(GPIOC, SPI_MOSI); 
 515  0021 4b40          	push	#64
 516  0023 ae500a        	ldw	x,#20490
 517  0026 cd0000        	call	_GPIO_WriteLow
 519  0029 84            	pop	a
 520  002a               L711:
 521                     ; 85 		GPIO_WriteHigh(GPIOC, SPI_CLK);
 523  002a 4b20          	push	#32
 524  002c ae500a        	ldw	x,#20490
 525  002f cd0000        	call	_GPIO_WriteHigh
 527  0032 84            	pop	a
 528                     ; 86 		nop();nop();nop();
 531  0033 9d            nop
 537  0034 9d            nop
 543  0035 9d            nop
 545                     ; 87 		out = out<<1; 		
 548  0036 0802          	sll	(OFST+1,sp)
 549                     ; 73 	for(j=0;j<8;j++)
 551  0038 0c01          	inc	(OFST+0,sp)
 554  003a 7b01          	ld	a,(OFST+0,sp)
 555  003c a108          	cp	a,#8
 556  003e 25c4          	jrult	L701
 557                     ; 90 }
 560  0040 85            	popw	x
 561  0041 81            	ret
 597                     ; 91 void Translate2(void)
 597                     ; 92 { 
 598                     .text:	section	.text,new
 599  0000               _Translate2:
 601  0000 88            	push	a
 602       00000001      OFST:	set	1
 605                     ; 94 	for(j=0;j<8;j++)
 607  0001 0f01          	clr	(OFST+0,sp)
 608  0003               L531:
 609                     ; 96 		GPIO_WriteLow(GPIOC, SPI_CLK);	 	
 611  0003 4b20          	push	#32
 612  0005 ae500a        	ldw	x,#20490
 613  0008 cd0000        	call	_GPIO_WriteLow
 615  000b 84            	pop	a
 616                     ; 97 		nop();
 619  000c 9d            nop
 621                     ; 98 		GPIO_WriteHigh(GPIOC, SPI_CLK); 
 624  000d 4b20          	push	#32
 625  000f ae500a        	ldw	x,#20490
 626  0012 cd0000        	call	_GPIO_WriteHigh
 628  0015 84            	pop	a
 629                     ; 99 		nop();
 632  0016 9d            nop
 634                     ; 94 	for(j=0;j<8;j++)
 637  0017 0c01          	inc	(OFST+0,sp)
 640  0019 7b01          	ld	a,(OFST+0,sp)
 641  001b a108          	cp	a,#8
 642  001d 25e4          	jrult	L531
 643                     ; 102 }
 646  001f 84            	pop	a
 647  0020 81            	ret
 696                     ; 104 unsigned char Receive(void)
 696                     ; 105 {
 697                     .text:	section	.text,new
 698  0000               _Receive:
 700  0000 89            	pushw	x
 701       00000002      OFST:	set	2
 704                     ; 107 	for(j=0;j<8;j++)
 706  0001 0f01          	clr	(OFST-1,sp)
 707  0003               L161:
 708                     ; 109 		r=r<<1;
 710  0003 0802          	sll	(OFST+0,sp)
 711                     ; 110 		GPIO_WriteLow(GPIOC, SPI_CLK); 		
 713  0005 4b20          	push	#32
 714  0007 ae500a        	ldw	x,#20490
 715  000a cd0000        	call	_GPIO_WriteLow
 717  000d 84            	pop	a
 718                     ; 111 		nop();nop();nop();
 721  000e 9d            nop
 727  000f 9d            nop
 733  0010 9d            nop
 735                     ; 112 		if(GPIO_ReadInputPin(GPIOC,SPI_MISO)) 
 738  0011 4b80          	push	#128
 739  0013 ae500a        	ldw	x,#20490
 740  0016 cd0000        	call	_GPIO_ReadInputPin
 742  0019 5b01          	addw	sp,#1
 743  001b 4d            	tnz	a
 744  001c 2706          	jreq	L761
 745                     ; 113 			r|=1;    
 747  001e 7b02          	ld	a,(OFST+0,sp)
 748  0020 aa01          	or	a,#1
 749  0022 6b02          	ld	(OFST+0,sp),a
 750  0024               L761:
 751                     ; 114 		GPIO_WriteHigh(GPIOC, SPI_CLK); 
 753  0024 4b20          	push	#32
 754  0026 ae500a        	ldw	x,#20490
 755  0029 cd0000        	call	_GPIO_WriteHigh
 757  002c 84            	pop	a
 758                     ; 115 		nop();nop();nop();	 
 761  002d 9d            nop
 767  002e 9d            nop
 773  002f 9d            nop
 775                     ; 116 		nop();	
 779  0030 9d            nop
 781                     ; 107 	for(j=0;j<8;j++)
 784  0031 0c01          	inc	(OFST-1,sp)
 787  0033 7b01          	ld	a,(OFST-1,sp)
 788  0035 a108          	cp	a,#8
 789  0037 25ca          	jrult	L161
 790                     ; 119 	return r;
 792  0039 7b02          	ld	a,(OFST+0,sp)
 795  003b 85            	popw	x
 796  003c 81            	ret
 821                     ; 123 void InitBeep(void)
 821                     ; 124 { 
 822                     .text:	section	.text,new
 823  0000               _InitBeep:
 827                     ; 125 	BEEP_LSICalibrationConfig(128000);
 829  0000 aef400        	ldw	x,#62464
 830  0003 89            	pushw	x
 831  0004 ae0001        	ldw	x,#1
 832  0007 89            	pushw	x
 833  0008 cd0000        	call	_BEEP_LSICalibrationConfig
 835  000b 5b04          	addw	sp,#4
 836                     ; 126 	BEEP_Init(BEEP_FREQUENCY_1KHZ);
 838  000d 4f            	clr	a
 839  000e cd0000        	call	_BEEP_Init
 841                     ; 128 }
 844  0011 81            	ret
 847                     	switch	.data
 848  0006               _gcBeepTrig:
 849  0006 00            	dc.b	0
 850  0007               _gcNumBeep:
 851  0007 0000          	dc.w	0
 877                     ; 135 void TaskBeep(void)
 877                     ; 136 {      
 878                     .text:	section	.text,new
 879  0000               _TaskBeep:
 883                     ; 137 	if(!gcBeepTrig)
 885  0000 725d0006      	tnz	_gcBeepTrig
 886  0004 260d          	jrne	L112
 887                     ; 139 		SetWarningFreq(1000);
 889  0006 ae03e8        	ldw	x,#1000
 890  0009 cd0000        	call	_SetWarningFreq
 892                     ; 140 		BEEP_Cmd(ENABLE);	
 894  000c a601          	ld	a,#1
 895  000e cd0000        	call	_BEEP_Cmd
 898  0011 201f          	jra	L312
 899  0013               L112:
 900                     ; 144 		SetWarningFreq(0);
 902  0013 5f            	clrw	x
 903  0014 cd0000        	call	_SetWarningFreq
 905                     ; 145 		BEEP_Cmd(DISABLE);
 907  0017 4f            	clr	a
 908  0018 cd0000        	call	_BEEP_Cmd
 910                     ; 146 		gcNumBeep--;
 912  001b ce0007        	ldw	x,_gcNumBeep
 913  001e 1d0001        	subw	x,#1
 914  0021 cf0007        	ldw	_gcNumBeep,x
 915                     ; 147 		if(gcNumBeep==0)
 917  0024 ce0007        	ldw	x,_gcNumBeep
 918  0027 2609          	jrne	L312
 919                     ; 149 			GPIOD->ODR&=(~0x80);	
 921  0029 721f500f      	bres	20495,#7
 922                     ; 150 	    SuspendTask(TASK_BEEP);
 924  002d a604          	ld	a,#4
 925  002f cd0000        	call	_SuspendTask
 927  0032               L312:
 928                     ; 153 	gcBeepTrig=!gcBeepTrig;	  
 930  0032 725d0006      	tnz	_gcBeepTrig
 931  0036 2604          	jrne	L06
 932  0038 a601          	ld	a,#1
 933  003a 2001          	jra	L26
 934  003c               L06:
 935  003c 4f            	clr	a
 936  003d               L26:
 937  003d c70006        	ld	_gcBeepTrig,a
 938                     ; 154 }
 941  0040 81            	ret
 989                     ; 161 void Beep(UCHAR	cNumBeep,UINT beepTime)
 989                     ; 162 {
 990                     .text:	section	.text,new
 991  0000               _Beep:
 993  0000 88            	push	a
 994  0001 89            	pushw	x
 995       00000002      OFST:	set	2
 998                     ; 165 	gcNumBeep=cNumBeep;
1000  0002 5f            	clrw	x
1001  0003 97            	ld	xl,a
1002  0004 cf0007        	ldw	_gcNumBeep,x
1003                     ; 167 	a=beepTime;	//mS
1005  0007 1e06          	ldw	x,(OFST+4,sp)
1006  0009 1f01          	ldw	(OFST-1,sp),x
1007                     ; 170 	ActiveTask(TASK_BEEP,a);
1009  000b 1e01          	ldw	x,(OFST-1,sp)
1010  000d cd0000        	call	c_itolx
1012  0010 be02          	ldw	x,c_lreg+2
1013  0012 89            	pushw	x
1014  0013 be00          	ldw	x,c_lreg
1015  0015 89            	pushw	x
1016  0016 a604          	ld	a,#4
1017  0018 cd0000        	call	_ActiveTask
1019  001b 5b04          	addw	sp,#4
1020                     ; 171 }
1023  001d 5b03          	addw	sp,#3
1024  001f 81            	ret
1050                     ; 173 void StopBeep(void)	  
1050                     ; 174 {
1051                     .text:	section	.text,new
1052  0000               _StopBeep:
1056                     ; 175 	SetWarningFreq(0);
1058  0000 5f            	clrw	x
1059  0001 cd0000        	call	_SetWarningFreq
1061                     ; 176 	BEEP_Cmd(DISABLE); 
1063  0004 4f            	clr	a
1064  0005 cd0000        	call	_BEEP_Cmd
1066                     ; 177 	SuspendTask(TASK_BEEP);
1068  0008 a604          	ld	a,#4
1069  000a cd0000        	call	_SuspendTask
1071                     ; 178 }
1074  000d 81            	ret
1077                     	switch	.data
1078  0009               _gcMotorDir:
1079  0009 00            	dc.b	0
1080  000a               _gcTimer_Motor_ID:
1081  000a ff            	dc.b	255
1118                     ; 189 signed char MovMotor(unsigned char cPos)
1118                     ; 190 {	  
1119                     .text:	section	.text,new
1120  0000               _MovMotor:
1122  0000 88            	push	a
1123       00000000      OFST:	set	0
1126                     ; 191 	if(IED.cMoving==1)
1128  0001 c6001f        	ld	a,_IED+2
1129  0004 a101          	cp	a,#1
1130  0006 2605          	jrne	L372
1131                     ; 193 		return -1;
1133  0008 a6ff          	ld	a,#255
1136  000a 5b01          	addw	sp,#1
1137  000c 81            	ret
1138  000d               L372:
1139                     ; 195 	_nop_();	
1142  000d 9d            nop
1144                     ; 196 	if(cPos==IED.cPos)
1146  000e 7b01          	ld	a,(OFST+1,sp)
1147  0010 c1001e        	cp	a,_IED+1
1148  0013 2605          	jrne	L572
1149                     ; 201 		return -2;
1151  0015 a6fe          	ld	a,#254
1154  0017 5b01          	addw	sp,#1
1155  0019 81            	ret
1156  001a               L572:
1157                     ; 203 	_nop_();
1160  001a 9d            nop
1162                     ; 204 	MOTOR__RUN = 0; 
1164  001b 72150003      	bres	_SPIIO+3,#2
1165  001f 72170003      	bres	_SPIIO+3,#3
1166                     ; 208 	 switch(cPos)
1168  0023 7b01          	ld	a,(OFST+1,sp)
1170                     ; 220 		case POS_UNKNOWN:	 
1170                     ; 221 		default:
1170                     ; 222 			return -5;	 
1171  0025 4d            	tnz	a
1172  0026 270b          	jreq	L742
1173  0028 4a            	dec	a
1174  0029 2714          	jreq	L352
1175  002b 4a            	dec	a
1176  002c 270b          	jreq	L152
1177  002e 4a            	dec	a
1178  002f 2713          	jreq	L552
1179  0031 2011          	jra	L552
1180  0033               L742:
1181                     ; 210 	 	case POS_TOP:				  				//到顶,方向为向上
1181                     ; 211 			IED.Direction=MOTOR_UP; 
1183  0033 725f002e      	clr	_IED+17
1184                     ; 213 			break;
1186  0037 2010          	jra	L103
1187  0039               L152:
1188                     ; 214 		case POS_BOT:
1188                     ; 215 			IED.Direction=MOTOR_DOWN; 				//到底,方向为向下 
1190  0039 3501002e      	mov	_IED+17,#1
1191                     ; 217 			break;
1193  003d 200a          	jra	L103
1194  003f               L352:
1195                     ; 218 		case POS_MIDDLE:							
1195                     ; 219 			return -2;
1197  003f a6fe          	ld	a,#254
1200  0041 5b01          	addw	sp,#1
1201  0043 81            	ret
1202  0044               L552:
1203                     ; 220 		case POS_UNKNOWN:	 
1203                     ; 221 		default:
1203                     ; 222 			return -5;	 
1205  0044 a6fb          	ld	a,#251
1208  0046 5b01          	addw	sp,#1
1209  0048 81            	ret
1210  0049               L103:
1211                     ; 225 	 if((IED.Err&ERR_TOP_OVERROLL)&&( MOTOR_UP==IED.Direction))	 //上过卷,禁止上行
1213  0049 c60021        	ld	a,_IED+4
1214  004c a504          	bcp	a,#4
1215  004e 270b          	jreq	L303
1217  0050 725d002e      	tnz	_IED+17
1218  0054 2605          	jrne	L303
1219                     ; 226 			return -4;	  
1221  0056 a6fc          	ld	a,#252
1224  0058 5b01          	addw	sp,#1
1225  005a 81            	ret
1226  005b               L303:
1227                     ; 227 	 if((IED.Err&ERR_BOT_OVERROLL)&&( MOTOR_DOWN==IED.Direction))	 	//下过卷,禁止下行
1229  005b c60021        	ld	a,_IED+4
1230  005e a508          	bcp	a,#8
1231  0060 270c          	jreq	L503
1233  0062 c6002e        	ld	a,_IED+17
1234  0065 a101          	cp	a,#1
1235  0067 2605          	jrne	L503
1236                     ; 228 			return -4;	  
1238  0069 a6fc          	ld	a,#252
1241  006b 5b01          	addw	sp,#1
1242  006d 81            	ret
1243  006e               L503:
1244                     ; 237 	if(IED.Err&(ErrPhase|						 //相位错
1244                     ; 238 				ErrOverHeat|MAIN_POWER_ERROR|	 //过热//无主电
1244                     ; 239 				COIL_SHORT_ERR|COIL_BREAK_ERR| 	 //刹车线圈坏 
1244                     ; 240 				ERR_MOTOR_LINE|									//电机断线
1244                     ; 241 				ERR_RELAY_FAIL|									//继电器损坏
1244                     ; 242 				ERR_BRAKE_POWER_FAIL
1244                     ; 243 				))
1246  006e ce0021        	ldw	x,_IED+4
1247  0071 01            	rrwa	x,a
1248  0072 a4c7          	and	a,#199
1249  0074 01            	rrwa	x,a
1250  0075 a470          	and	a,#112
1251  0077 01            	rrwa	x,a
1252  0078 a30000        	cpw	x,#0
1253  007b 2705          	jreq	L703
1254                     ; 245 		return -4;	 
1256  007d a6fc          	ld	a,#252
1259  007f 5b01          	addw	sp,#1
1260  0081 81            	ret
1261  0082               L703:
1262                     ; 248 	UNLockAllMotor();
1264  0082 cd0000        	call	_UNLockAllMotor
1266                     ; 249 	EnableBrakPower(TRUE);	   
1268  0085 a601          	ld	a,#1
1269  0087 cd0000        	call	_EnableBrakPower
1271                     ; 250 	IED.cMoving = 1;	  
1273  008a 3501001f      	mov	_IED+2,#1
1274                     ; 252 	IED.BrakeDelayTimerID = StartTimer(TIMER_MODE_ONCEROUTINE,
1274                     ; 253 				20L,MotorDelay,0);			    
1276  008e 5f            	clrw	x
1277  008f 89            	pushw	x
1278  0090 ae0000        	ldw	x,#_MotorDelay
1279  0093 89            	pushw	x
1280  0094 ae0014        	ldw	x,#20
1281  0097 89            	pushw	x
1282  0098 ae0000        	ldw	x,#0
1283  009b 89            	pushw	x
1284  009c a601          	ld	a,#1
1285  009e cd0000        	call	_StartTimer
1287  00a1 5b08          	addw	sp,#8
1288  00a3 c70036        	ld	_IED+25,a
1289                     ; 255 	return 0; 
1291  00a6 4f            	clr	a
1294  00a7 5b01          	addw	sp,#1
1295  00a9 81            	ret
1320                     ; 259 void ErrStopMotor(void)
1320                     ; 260 { 
1321                     .text:	section	.text,new
1322  0000               _ErrStopMotor:
1326                     ; 262 	LockAllMotor();
1328  0000 cd0000        	call	_LockAllMotor
1330                     ; 263 	StopMotor();
1332  0003 cd0000        	call	_StopMotor
1334                     ; 264 }
1337  0006 81            	ret
1365                     ; 266 void StopMotor(void)
1365                     ; 267 {
1366                     .text:	section	.text,new
1367  0000               _StopMotor:
1371                     ; 268 	MOTOR__RUN = 0;		  
1373  0000 72150003      	bres	_SPIIO+3,#2
1374  0004 72170003      	bres	_SPIIO+3,#3
1375                     ; 269 	ConvertDown(0);//停止逆变
1377  0008 4f            	clr	a
1378  0009 cd0000        	call	_ConvertDown
1380                     ; 271 	StopTimer(&IED.MotorMoveDelayTimerID);
1382  000c ae0035        	ldw	x,#_IED+24
1383  000f cd0000        	call	_StopTimer
1385                     ; 272 	SuspendTask(TASK_STOPMOTOR); 
1387  0012 a608          	ld	a,#8
1388  0014 cd0000        	call	_SuspendTask
1390                     ; 273 	IED.cMoving = 0;
1392  0017 725f001f      	clr	_IED+2
1393                     ; 277 }
1396  001b 81            	ret
1422                     ; 279 void GetCurretPos(void)
1422                     ; 280 {	
1423                     .text:	section	.text,new
1424  0000               _GetCurretPos:
1428                     ; 281 	if(pos_top_bit==0)
1430  0000 c60004        	ld	a,_SPIIO+4
1431  0003 a540          	bcp	a,#64
1432  0005 2606          	jrne	L143
1433                     ; 283 		IED.cPos = POS_TOP; 
1435  0007 725f001e      	clr	_IED+1
1437  000b 2011          	jra	L343
1438  000d               L143:
1439                     ; 285 	else if(pos_bot_bit==0)
1441  000d c60004        	ld	a,_SPIIO+4
1442  0010 a580          	bcp	a,#128
1443  0012 2606          	jrne	L543
1444                     ; 287 		IED.cPos = POS_BOT;    
1446  0014 3502001e      	mov	_IED+1,#2
1448  0018 2004          	jra	L343
1449  001a               L543:
1450                     ; 291 		IED.cPos = POS_UNKNOWN;
1452  001a 3503001e      	mov	_IED+1,#3
1453  001e               L343:
1454                     ; 296 	_nop_();
1457  001e 9d            nop
1459                     ; 297 }
1462  001f 81            	ret
1488                     ; 299 void EnableRunCtrl(void)
1488                     ; 300 {	
1489                     .text:	section	.text,new
1490  0000               _EnableRunCtrl:
1494                     ; 301 	if(gcPhaseCtrl)												  //运行方向控制、、 	    	  
1496  0000 725d0008      	tnz	_gcPhaseCtrl
1497  0004 271c          	jreq	L163
1498                     ; 302 			MOTOR__RUN=	~(IED.Direction==MOTOR_UP?1:2);	  
1500  0006 725d002e      	tnz	_IED+17
1501  000a 2604          	jrne	L201
1502  000c a601          	ld	a,#1
1503  000e 2002          	jra	L401
1504  0010               L201:
1505  0010 a602          	ld	a,#2
1506  0012               L401:
1507  0012 43            	cpl	a
1508  0013 48            	sll	a
1509  0014 48            	sll	a
1510  0015 c80003        	xor	a,_SPIIO+3
1511  0018 a40c          	and	a,#12
1512  001a c80003        	xor	a,_SPIIO+3
1513  001d c70003        	ld	_SPIIO+3,a
1515  0020 2019          	jra	L363
1516  0022               L163:
1517                     ; 304 			MOTOR__RUN=	(IED.Direction==MOTOR_UP?1:2);   
1519  0022 725d002e      	tnz	_IED+17
1520  0026 2604          	jrne	L601
1521  0028 a601          	ld	a,#1
1522  002a 2002          	jra	L011
1523  002c               L601:
1524  002c a602          	ld	a,#2
1525  002e               L011:
1526  002e 48            	sll	a
1527  002f 48            	sll	a
1528  0030 c80003        	xor	a,_SPIIO+3
1529  0033 a40c          	and	a,#12
1530  0035 c80003        	xor	a,_SPIIO+3
1531  0038 c70003        	ld	_SPIIO+3,a
1532  003b               L363:
1533                     ; 305 }
1536  003b 81            	ret
1570                     ; 307 void TaskStopMotor(void)								//TASK_MOTOR
1570                     ; 308 { 	
1571                     .text:	section	.text,new
1572  0000               _TaskStopMotor:
1576                     ; 309 	if(Warning_flag==0)
1578  0000 725d0000      	tnz	_Warning_flag
1579  0004 260a          	jrne	L573
1580                     ; 310 		Beep(1,200); 
1582  0006 ae00c8        	ldw	x,#200
1583  0009 89            	pushw	x
1584  000a a601          	ld	a,#1
1585  000c cd0000        	call	_Beep
1587  000f 85            	popw	x
1588  0010               L573:
1589                     ; 312 	EnableRunCtrl();
1591  0010 cd0000        	call	_EnableRunCtrl
1593                     ; 314 	GetCurretPos();
1595  0013 cd0000        	call	_GetCurretPos
1597                     ; 317 	if(((IED.Direction==MOTOR_UP)&&(pos_top_bit==0))		////运行方向向上,检测到上到位 停止
1597                     ; 318 		||((IED.Direction==MOTOR_DOWN)&&(pos_bot_bit==0)))	//运行方向向下,检测到下到位 停止
1599  0016 725d002e      	tnz	_IED+17
1600  001a 2607          	jrne	L304
1602  001c c60004        	ld	a,_SPIIO+4
1603  001f a540          	bcp	a,#64
1604  0021 270e          	jreq	L104
1605  0023               L304:
1607  0023 c6002e        	ld	a,_IED+17
1608  0026 a101          	cp	a,#1
1609  0028 260f          	jrne	L773
1611  002a c60004        	ld	a,_SPIIO+4
1612  002d a580          	bcp	a,#128
1613  002f 2608          	jrne	L773
1614  0031               L104:
1615                     ; 323 		EnableBrakPower(FALSE);
1617  0031 4f            	clr	a
1618  0032 cd0000        	call	_EnableBrakPower
1620                     ; 324 		StopMotor(); 
1622  0035 cd0000        	call	_StopMotor
1624                     ; 325 		_nop_(); 
1627  0038 9d            nop
1629  0039               L773:
1630                     ; 329 	CheckBrakePower();//检查刹车电源
1632  0039 cd0000        	call	_CheckBrakePower
1634                     ; 330 	if(IED.Err&(ERR_BRAKE_POWER_FAIL))
1636  003c c60021        	ld	a,_IED+4
1637  003f a540          	bcp	a,#64
1638  0041 2703          	jreq	L504
1639                     ; 331 		ErrStopMotor();
1641  0043 cd0000        	call	_ErrStopMotor
1643  0046               L504:
1644                     ; 332 }
1647  0046 81            	ret
1683                     ; 336 void ResumeCheckSensor(void* p)
1683                     ; 337 { 
1684                     .text:	section	.text,new
1685  0000               _ResumeCheckSensor:
1689                     ; 338 	ActiveTask(TASK_SENSOR,500UL);
1691  0000 ae01f4        	ldw	x,#500
1692  0003 89            	pushw	x
1693  0004 ae0000        	ldw	x,#0
1694  0007 89            	pushw	x
1695  0008 a60e          	ld	a,#14
1696  000a cd0000        	call	_ActiveTask
1698  000d 5b04          	addw	sp,#4
1699                     ; 339 }
1702  000f 81            	ret
1726                     ; 343 void StartWarning(void)
1726                     ; 344 {	
1727                     .text:	section	.text,new
1728  0000               _StartWarning:
1732                     ; 346  	ActiveTask(TASK_WARN,100);   
1734  0000 ae0064        	ldw	x,#100
1735  0003 89            	pushw	x
1736  0004 ae0000        	ldw	x,#0
1737  0007 89            	pushw	x
1738  0008 a607          	ld	a,#7
1739  000a cd0000        	call	_ActiveTask
1741  000d 5b04          	addw	sp,#4
1742                     ; 350 }
1745  000f 81            	ret
1771                     ; 354 void StopWarning(void)
1771                     ; 355 {			    
1772                     .text:	section	.text,new
1773  0000               _StopWarning:
1777                     ; 356 	SetWarningFreq(0);
1779  0000 5f            	clrw	x
1780  0001 cd0000        	call	_SetWarningFreq
1782                     ; 357   IED.b_warning = 0;   
1784  0004 725f0020      	clr	_IED+3
1785                     ; 358  	SuspendTask(TASK_WARN);	
1787  0008 a607          	ld	a,#7
1788  000a cd0000        	call	_SuspendTask
1790                     ; 363 } 
1793  000d 81            	ret
1821                     ; 364  void InitTim2(void)
1821                     ; 365  {
1822                     .text:	section	.text,new
1823  0000               _InitTim2:
1827                     ; 367   TIM2_DeInit();
1829  0000 cd0000        	call	_TIM2_DeInit
1831                     ; 368   TIM2_TimeBaseInit( TIM2_PRESCALER_16,50000);//50ms
1833  0003 aec350        	ldw	x,#50000
1834  0006 89            	pushw	x
1835  0007 a604          	ld	a,#4
1836  0009 cd0000        	call	_TIM2_TimeBaseInit
1838  000c 85            	popw	x
1839                     ; 369   TIM2_ITConfig( TIM2_IT_UPDATE , ENABLE);
1841  000d ae0001        	ldw	x,#1
1842  0010 a601          	ld	a,#1
1843  0012 95            	ld	xh,a
1844  0013 cd0000        	call	_TIM2_ITConfig
1846                     ; 371   TIM2_SetCounter(0x0000); 
1848  0016 5f            	clrw	x
1849  0017 cd0000        	call	_TIM2_SetCounter
1851                     ; 373   TIM2_Cmd(ENABLE);
1853  001a a601          	ld	a,#1
1854  001c cd0000        	call	_TIM2_Cmd
1856                     ; 376  }
1859  001f 81            	ret
1862                     	switch	.bss
1863  0000               L554_m:
1864  0000 00            	ds.b	1
1898                     ; 378  @far @interrupt void TIM2_UPD_OVF_BRK_IRQHandler(void)
1898                     ; 379  {
1900                     .text:	section	.text,new
1901  0000               f_TIM2_UPD_OVF_BRK_IRQHandler:
1903  0000 3b0002        	push	c_x+2
1904  0003 be00          	ldw	x,c_x
1905  0005 89            	pushw	x
1906  0006 3b0002        	push	c_y+2
1907  0009 be00          	ldw	x,c_y
1908  000b 89            	pushw	x
1911                     ; 381 	 TIM2_ClearITPendingBit(TIM2_IT_UPDATE);//清除中断标记位
1913  000c a601          	ld	a,#1
1914  000e cd0000        	call	_TIM2_ClearITPendingBit
1916                     ; 382 	 if(StopWarning_flag==1)
1918  0011 c60007        	ld	a,_StopWarning_flag
1919  0014 a101          	cp	a,#1
1920  0016 261c          	jrne	L374
1921                     ; 384 	   m++;
1923  0018 725c0000      	inc	L554_m
1924                     ; 385 	   if(m>=30)
1926  001c c60000        	ld	a,L554_m
1927  001f a11e          	cp	a,#30
1928  0021 2511          	jrult	L374
1929                     ; 387 		   StopWarning_flag=0;
1931  0023 725f0007      	clr	_StopWarning_flag
1932                     ; 388 			 GPIO_WriteHigh(GPIOA, GPIO_PIN_2);//关闭3S后重新开启
1934  0027 4b04          	push	#4
1935  0029 ae5000        	ldw	x,#20480
1936  002c cd0000        	call	_GPIO_WriteHigh
1938  002f 84            	pop	a
1939                     ; 389        m=0;
1941  0030 725f0000      	clr	L554_m
1942  0034               L374:
1943                     ; 393   }
1946  0034 85            	popw	x
1947  0035 bf00          	ldw	c_y,x
1948  0037 320002        	pop	c_y+2
1949  003a 85            	popw	x
1950  003b bf00          	ldw	c_x,x
1951  003d 320002        	pop	c_x+2
1952  0040 80            	iret
1976                     	switch	.const
1977  0019               L031:
1978  0019 000005dc      	dc.l	1500
1979  001d               L231:
1980  001d 000001c3      	dc.l	451
1981                     ; 402 void TaskWarn(void)
1981                     ; 403 {	
1982                     	scross	off
1983                     .text:	section	.text,new
1984  0000               _TaskWarn:
1988                     ; 405 		SetWarningFreq(IED.FreqCurr);	
1990  0000 ce002b        	ldw	x,_IED+14
1991  0003 cd0000        	call	_SetWarningFreq
1993                     ; 408 	if(IED.FreqCurr>=FREQ_MAX)
1995  0006 9c            	rvf
1996  0007 ce002b        	ldw	x,_IED+14
1997  000a cd0000        	call	c_uitolx
1999  000d ae0019        	ldw	x,#L031
2000  0010 cd0000        	call	c_lcmp
2002  0013 2f0a          	jrslt	L705
2003                     ; 410 		IED.FreqCurr =	FREQ_MAX;
2005  0015 ae05dc        	ldw	x,#1500
2006  0018 cf002b        	ldw	_IED+14,x
2007                     ; 411 		IED.Freqdir=-1;
2009  001b 35ff002d      	mov	_IED+16,#255
2010  001f               L705:
2011                     ; 413 	if(IED.FreqCurr<=FREQ_MIN)
2013  001f 9c            	rvf
2014  0020 ce002b        	ldw	x,_IED+14
2015  0023 cd0000        	call	c_uitolx
2017  0026 ae001d        	ldw	x,#L231
2018  0029 cd0000        	call	c_lcmp
2020  002c 2e0a          	jrsge	L115
2021                     ; 415 		IED.FreqCurr =	FREQ_MIN;
2023  002e ae01c2        	ldw	x,#450
2024  0031 cf002b        	ldw	_IED+14,x
2025                     ; 416 		IED.Freqdir=1;
2027  0034 3501002d      	mov	_IED+16,#1
2028  0038               L115:
2029                     ; 418 	IED.FreqCurr+=IED.Freqdir*20;		 
2031  0038 5f            	clrw	x
2032  0039 c6002d        	ld	a,_IED+16
2033  003c 2a01          	jrpl	L431
2034  003e 53            	cplw	x
2035  003f               L431:
2036  003f 97            	ld	xl,a
2037  0040 90ae0014      	ldw	y,#20
2038  0044 cd0000        	call	c_imul
2040  0047 72bb002b      	addw	x,_IED+14
2041  004b cf002b        	ldw	_IED+14,x
2042                     ; 419 }	 
2045  004e 81            	ret
2083                     ; 423 void MotorDelay(void *p)
2083                     ; 424 {
2084                     .text:	section	.text,new
2085  0000               _MotorDelay:
2089                     ; 425 	IED.BrakeDelayTimerID  = -1;
2091  0000 35ff0036      	mov	_IED+25,#255
2092                     ; 426 	EnableRunCtrl();
2094  0004 cd0000        	call	_EnableRunCtrl
2096                     ; 427 	ActiveTask(TASK_STOPMOTOR,50);	////每50ms检测一次电机是否到位
2098  0007 ae0032        	ldw	x,#50
2099  000a 89            	pushw	x
2100  000b ae0000        	ldw	x,#0
2101  000e 89            	pushw	x
2102  000f a608          	ld	a,#8
2103  0011 cd0000        	call	_ActiveTask
2105  0014 5b04          	addw	sp,#4
2106                     ; 431 }
2109  0016 81            	ret
2112                     	switch	.data
2113  000b               _HiCnt:
2114  000b 0000          	dc.w	0
2115  000d               _LowCnt:
2116  000d 0000          	dc.w	0
2146                     ; 437 int abs(int x) {return x>0?x:-x;}
2147                     .text:	section	.text,new
2148  0000               _abs:
2154  0000 9c            	rvf
2155  0001 a30000        	cpw	x,#0
2156  0004 2d02          	jrsle	L241
2157  0006 2001          	jra	L441
2158  0008               L241:
2159  0008 50            	negw	x
2160  0009               L441:
2163  0009 81            	ret
2201                     	switch	.const
2202  0021               L051:
2203  0021 00000078      	dc.l	120
2204                     ; 438 void TaskCheckPhase(void)		   
2204                     ; 439 {
2205                     .text:	section	.text,new
2206  0000               _TaskCheckPhase:
2208  0000 89            	pushw	x
2209       00000002      OFST:	set	2
2212                     ; 444 	err = abs(HiCnt-LowCnt);
2214  0001 ce000b        	ldw	x,_HiCnt
2215  0004 72b0000d      	subw	x,_LowCnt
2216  0008 cd0000        	call	_abs
2218  000b 1f01          	ldw	(OFST-1,sp),x
2219                     ; 445 	if(err<60*PHASE_PRIOD/1000L)
2221  000d 9c            	rvf
2222  000e 1e01          	ldw	x,(OFST-1,sp)
2223  0010 cd0000        	call	c_itolx
2225  0013 ae0021        	ldw	x,#L051
2226  0016 cd0000        	call	c_lcmp
2228  0019 2e11          	jrsge	L165
2229                     ; 450 		ErrStopMotor();
2231  001b cd0000        	call	_ErrStopMotor
2233                     ; 451 		IED.Err |= ErrPhase;
2235  001e 72100022      	bset	_IED+5,#0
2236                     ; 453 		IED.Err &= (~ERR_BRAKE_POWER_FAIL);
2238  0022 721d0021      	bres	_IED+4,#6
2239                     ; 454 		IED.Err &= (~ERR_RELAY_FAIL);
2241  0026 721b0021      	bres	_IED+4,#5
2243  002a 201b          	jra	L365
2244  002c               L165:
2245                     ; 458 		if(HiCnt>LowCnt)
2247  002c 9c            	rvf
2248  002d ce000b        	ldw	x,_HiCnt
2249  0030 c3000d        	cpw	x,_LowCnt
2250  0033 2d0a          	jrsle	L565
2251                     ; 460 	 		gcPhaseCtrl =1;		//相位反过来了      
2253  0035 35010008      	mov	_gcPhaseCtrl,#1
2254                     ; 461 			IED.Err &= (~ErrPhase); 
2256  0039 72110022      	bres	_IED+5,#0
2258  003d 2008          	jra	L365
2259  003f               L565:
2260                     ; 469 			IED.Err |= ErrPhase;   //锁定这个相位
2262  003f 72100022      	bset	_IED+5,#0
2263                     ; 470 			gcPhaseCtrl =0;		//正确相位
2265  0043 725f0008      	clr	_gcPhaseCtrl
2266  0047               L365:
2267                     ; 477 	LowCnt = HiCnt     =0;	 
2269  0047 5f            	clrw	x
2270  0048 cf000b        	ldw	_HiCnt,x
2271  004b 5f            	clrw	x
2272  004c cf000d        	ldw	_LowCnt,x
2273                     ; 480 } 
2276  004f 85            	popw	x
2277  0050 81            	ret
2329                     ; 483 void TaskFREQ(void)
2329                     ; 484 {   
2330                     .text:	section	.text,new
2331  0000               _TaskFREQ:
2333  0000 89            	pushw	x
2334       00000002      OFST:	set	2
2337                     ; 486 	char PhaseIn = GPIOD->IDR; 
2339  0001 c65010        	ld	a,20496
2340  0004 6b02          	ld	(OFST+0,sp),a
2341                     ; 487 	Ph1 = PhaseIn&0x04;
2343  0006 7b02          	ld	a,(OFST+0,sp)
2344  0008 a404          	and	a,#4
2345  000a 6b01          	ld	(OFST-1,sp),a
2346                     ; 488 	Ph2 = PhaseIn&0x08; 
2348  000c 7b02          	ld	a,(OFST+0,sp)
2349  000e a408          	and	a,#8
2350  0010 6b02          	ld	(OFST+0,sp),a
2351                     ; 489 	if((!Ph1)&&(Ph1!=PreEx1))		 //下降沿
2353  0012 0d01          	tnz	(OFST-1,sp)
2354  0014 261f          	jrne	L116
2356  0016 7b01          	ld	a,(OFST-1,sp)
2357  0018 c10006        	cp	a,_PreEx1
2358  001b 2718          	jreq	L116
2359                     ; 491 		if(Ph2)
2361  001d 0d02          	tnz	(OFST+0,sp)
2362  001f 270b          	jreq	L316
2363                     ; 492 			HiCnt ++;
2365  0021 ce000b        	ldw	x,_HiCnt
2366  0024 1c0001        	addw	x,#1
2367  0027 cf000b        	ldw	_HiCnt,x
2369  002a 2009          	jra	L116
2370  002c               L316:
2371                     ; 494 			LowCnt ++;	 
2373  002c ce000d        	ldw	x,_LowCnt
2374  002f 1c0001        	addw	x,#1
2375  0032 cf000d        	ldw	_LowCnt,x
2376  0035               L116:
2377                     ; 496 	if((!Ph2)&&(Ph2!=PreEx2))
2379  0035 0d02          	tnz	(OFST+0,sp)
2380  0037 261f          	jrne	L716
2382  0039 7b02          	ld	a,(OFST+0,sp)
2383  003b c10005        	cp	a,_PreEx2
2384  003e 2718          	jreq	L716
2385                     ; 498 		if(Ph1)
2387  0040 0d01          	tnz	(OFST-1,sp)
2388  0042 270b          	jreq	L126
2389                     ; 499 			LowCnt ++; 
2391  0044 ce000d        	ldw	x,_LowCnt
2392  0047 1c0001        	addw	x,#1
2393  004a cf000d        	ldw	_LowCnt,x
2395  004d 2009          	jra	L716
2396  004f               L126:
2397                     ; 501 			HiCnt  ++;	   
2399  004f ce000b        	ldw	x,_HiCnt
2400  0052 1c0001        	addw	x,#1
2401  0055 cf000b        	ldw	_HiCnt,x
2402  0058               L716:
2403                     ; 503 	PreEx1 	= Ph1;
2405  0058 7b01          	ld	a,(OFST-1,sp)
2406  005a c70006        	ld	_PreEx1,a
2407                     ; 504 	PreEx2	= Ph2; 
2409  005d 7b02          	ld	a,(OFST+0,sp)
2410  005f c70005        	ld	_PreEx2,a
2411                     ; 505 	if((pos_bot_bit==0)&&(pos_top_bit==0))//过热保护
2413  0062 c60004        	ld	a,_SPIIO+4
2414  0065 a580          	bcp	a,#128
2415  0067 260d          	jrne	L526
2417  0069 c60004        	ld	a,_SPIIO+4
2418  006c a540          	bcp	a,#64
2419  006e 2606          	jrne	L526
2420                     ; 507 		IED.Err |= ErrOverHeat;
2422  0070 72120022      	bset	_IED+5,#1
2424  0074 2004          	jra	L726
2425  0076               L526:
2426                     ; 511 		IED.Err &= (~ErrOverHeat); 
2428  0076 72130022      	bres	_IED+5,#1
2429  007a               L726:
2430                     ; 513 }
2433  007a 85            	popw	x
2434  007b 81            	ret
2437                     	switch	.data
2438  000f               _preIDMode:
2439  000f 03            	dc.b	3
2466                     ; 517 void checkSetIDMode(void)
2466                     ; 518 {	//用户模式和检测模式切换
2467                     .text:	section	.text,new
2468  0000               _checkSetIDMode:
2470  0000 88            	push	a
2471       00000001      OFST:	set	1
2474                     ; 519 	if(preIDMode!=ID_SET)
2476  0001 c60004        	ld	a,_SPIIO+4
2477  0004 a401          	and	a,#1
2478  0006 6b01          	ld	(OFST+0,sp),a
2479  0008 c6000f        	ld	a,_preIDMode
2480  000b 1101          	cp	a,(OFST+0,sp)
2481  000d 271b          	jreq	L146
2482                     ; 521 		EEReadStruct(&IED.nId ,sizeof(IED.nId)/sizeof(char),0); 
2484  000f 5f            	clrw	x
2485  0010 89            	pushw	x
2486  0011 ae0001        	ldw	x,#1
2487  0014 89            	pushw	x
2488  0015 ae001d        	ldw	x,#_IED
2489  0018 cd0000        	call	_EEReadStruct
2491  001b 5b04          	addw	sp,#4
2492                     ; 522 		checkID();
2494  001d cd0000        	call	_checkID
2496                     ; 523 		Beep(1,500); 
2498  0020 ae01f4        	ldw	x,#500
2499  0023 89            	pushw	x
2500  0024 a601          	ld	a,#1
2501  0026 cd0000        	call	_Beep
2503  0029 85            	popw	x
2504  002a               L146:
2505                     ; 525 	preIDMode = ID_SET;
2507  002a c60004        	ld	a,_SPIIO+4
2508  002d a401          	and	a,#1
2509  002f c7000f        	ld	_preIDMode,a
2510                     ; 526 }
2513  0032 84            	pop	a
2514  0033 81            	ret
2539                     ; 530 void MuteError(void)
2539                     ; 531 {
2540                     .text:	section	.text,new
2541  0000               _MuteError:
2545                     ; 532 	IED.ErrMute=(IED.Err&UNMASKERR); 
2547  0000 ce0021        	ldw	x,_IED+4
2548  0003 cf0023        	ldw	_IED+6,x
2549                     ; 533 	StopWarning();
2551  0006 cd0000        	call	_StopWarning
2553                     ; 534 }
2556  0009 81            	ret
2585                     ; 548 void Feed(void)
2585                     ; 549 {  										  	 
2586                     .text:	section	.text,new
2587  0000               _Feed:
2591                     ; 551 	if(IED.cMoving==1)		
2593  0000 c6001f        	ld	a,_IED+2
2594  0003 a101          	cp	a,#1
2595  0005 2606          	jrne	L366
2596                     ; 552 		FeedDoorRun = 0;
2598  0007 72150002      	bres	_SPIIO+2,#2
2600  000b 2004          	jra	L566
2601  000d               L366:
2602                     ; 554 		FeedDoorRun = 1;
2604  000d 72140002      	bset	_SPIIO+2,#2
2605  0011               L566:
2606                     ; 557 	if((IED.Err&(MAIN_POWER_ERROR|(gcPhaseCtrl?ErrPhase:0)))==0)
2608  0011 725d0008      	tnz	_gcPhaseCtrl
2609  0015 2705          	jreq	L261
2610  0017 ae0005        	ldw	x,#5
2611  001a 2003          	jra	L461
2612  001c               L261:
2613  001c ae0004        	ldw	x,#4
2614  001f               L461:
2615  001f 01            	rrwa	x,a
2616  0020 c40022        	and	a,_IED+5
2617  0023 01            	rrwa	x,a
2618  0024 c40021        	and	a,_IED+4
2619  0027 01            	rrwa	x,a
2620  0028 a30000        	cpw	x,#0
2621  002b 2606          	jrne	L766
2622                     ; 559 		LED_MAINPOWER = 0; 
2624  002d 721f0002      	bres	_SPIIO+2,#7
2626  0031 2004          	jra	L176
2627  0033               L766:
2628                     ; 563 		LED_MAINPOWER = 1;
2630  0033 721e0002      	bset	_SPIIO+2,#7
2631  0037               L176:
2632                     ; 567 	if(Warning_flag==1)
2634  0037 c60000        	ld	a,_Warning_flag
2635  003a a101          	cp	a,#1
2636  003c 2606          	jrne	L376
2637                     ; 569 		FeedWarnLED = 0;	  
2639  003e 72190002      	bres	_SPIIO+2,#4
2641  0042 2004          	jra	L576
2642  0044               L376:
2643                     ; 573 		FeedWarnLED = 1;
2645  0044 72180002      	bset	_SPIIO+2,#4
2646  0048               L576:
2647                     ; 575 	FeedRightPhaseLED	= gcPhaseCtrl?0:1; 
2649  0048 725d0008      	tnz	_gcPhaseCtrl
2650  004c 2702          	jreq	L271
2651  004e 2006          	jp	L661
2652  0050               L271:
2653  0050 72160002      	bset	_SPIIO+2,#3
2654  0054 2004          	jra	L071
2655  0056               L661:
2656  0056 72170002      	bres	_SPIIO+2,#3
2657  005a               L071:
2658                     ; 578 	if(IED.Err!=0)
2660  005a ce0021        	ldw	x,_IED+4
2661  005d 272a          	jreq	L307
2662                     ; 581 		IED.ErrMute&=IED.Err;  //故障已清除,消除故障消音位为下一次故障声音报警做准备
2664  005f ce0021        	ldw	x,_IED+4
2665  0062 01            	rrwa	x,a
2666  0063 c40024        	and	a,_IED+7
2667  0066 01            	rrwa	x,a
2668  0067 c40023        	and	a,_IED+6
2669  006a 01            	rrwa	x,a
2670  006b cf0023        	ldw	_IED+6,x
2671                     ; 586 		if(IED.Err^IED.ErrMute)
2673  006e ce0021        	ldw	x,_IED+4
2674  0071 01            	rrwa	x,a
2675  0072 c80024        	xor	a,_IED+7
2676  0075 01            	rrwa	x,a
2677  0076 c80023        	xor	a,_IED+6
2678  0079 01            	rrwa	x,a
2679  007a a30000        	cpw	x,#0
2680  007d 270a          	jreq	L307
2681                     ; 587 			Beep(1,300);
2683  007f ae012c        	ldw	x,#300
2684  0082 89            	pushw	x
2685  0083 a601          	ld	a,#1
2686  0085 cd0000        	call	_Beep
2688  0088 85            	popw	x
2689  0089               L307:
2690                     ; 593 	if((IED.Err&(BAT_LOW_ERR|BAT_SHORT|BAT_OVER_ERROR))==0)		//电池无过压欠压错误.备电指示正常
2692  0089 c60022        	ld	a,_IED+5
2693  008c a538          	bcp	a,#56
2694  008e 2606          	jrne	L507
2695                     ; 595 		LED_BAT = 0;	
2697  0090 721d0002      	bres	_SPIIO+2,#6
2699  0094 2004          	jra	L707
2700  0096               L507:
2701                     ; 599 		LED_BAT = 1;	
2703  0096 721c0002      	bset	_SPIIO+2,#6
2704  009a               L707:
2705                     ; 602   FeedErrFlash();			
2707  009a cd0000        	call	_FeedErrFlash
2709                     ; 605 }
2712  009d 81            	ret
2715                     	switch	.data
2716  0010               L117_i:
2717  0010 00            	dc.b	0
2749                     ; 608 void FeedErrFlash(void)
2749                     ; 609 {
2750                     .text:	section	.text,new
2751  0000               _FeedErrFlash:
2755                     ; 611 	i=(++i)%2;
2757  0000 725c0010      	inc	L117_i
2758  0004 c60010        	ld	a,L117_i
2759  0007 a401          	and	a,#1
2760  0009 c70010        	ld	L117_i,a
2761                     ; 612 	if(i==0)
2763  000c 725d0010      	tnz	L117_i
2764  0010 2678          	jrne	L727
2765                     ; 615 		if(IED.Err&(ErrPhase|MAIN_POWER_ERROR))
2767  0012 c60022        	ld	a,_IED+5
2768  0015 a505          	bcp	a,#5
2769  0017 2704          	jreq	L137
2770                     ; 616 			FeedLEDMPowerError = 0;
2772  0019 721f0000      	bres	_SPIIO,#7
2773  001d               L137:
2774                     ; 618 		if(IED.Err&(BAT_LOW_ERR|BAT_OVER_ERROR|BAT_SHORT))
2776  001d c60022        	ld	a,_IED+5
2777  0020 a538          	bcp	a,#56
2778  0022 2704          	jreq	L337
2779                     ; 619 			FeedLEDBatError = 0;
2781  0024 721d0000      	bres	_SPIIO,#6
2782  0028               L337:
2783                     ; 620 		if(IED.Err&(COIL_SHORT_ERR|COIL_BREAK_ERR))
2785  0028 c60022        	ld	a,_IED+5
2786  002b a5c0          	bcp	a,#192
2787  002d 2704          	jreq	L537
2788                     ; 621 			FeedLEDBrakeError = 0;
2790  002f 721b0000      	bres	_SPIIO,#5
2791  0033               L537:
2792                     ; 623 		if(IED.Err&ERR_SENSOR_SMOKE)
2794  0033 c60021        	ld	a,_IED+4
2795  0036 a501          	bcp	a,#1
2796  0038 2704          	jreq	L737
2797                     ; 624 			FeedLEDSmokeSensor = 0;
2799  003a 72110000      	bres	_SPIIO,#0
2800  003e               L737:
2801                     ; 625 		if(IED.Err&ERR_SENSOR_TEMP)
2803  003e c60021        	ld	a,_IED+4
2804  0041 a502          	bcp	a,#2
2805  0043 2704          	jreq	L147
2806                     ; 626 			FeedLEDTempSensor = 0;
2808  0045 72130000      	bres	_SPIIO,#1
2809  0049               L147:
2810                     ; 628 		if(IED.Err&(ERR_TOP_OVERROLL|ERR_BOT_OVERROLL|ErrOverHeat))
2812  0049 ce0021        	ldw	x,_IED+4
2813  004c 01            	rrwa	x,a
2814  004d a402          	and	a,#2
2815  004f 01            	rrwa	x,a
2816  0050 a40c          	and	a,#12
2817  0052 01            	rrwa	x,a
2818  0053 a30000        	cpw	x,#0
2819  0056 2704          	jreq	L347
2820                     ; 629 			FeedLEDOverRollSensor = 0;
2822  0058 72150000      	bres	_SPIIO,#2
2823  005c               L347:
2824                     ; 630 		if(IED.Err&	ERR_MOTOR_LINE)
2826  005c c60021        	ld	a,_IED+4
2827  005f a510          	bcp	a,#16
2828  0061 2704          	jreq	L547
2829                     ; 631 			FeedLEDMotorError = 0; 
2831  0063 72190000      	bres	_SPIIO,#4
2832  0067               L547:
2833                     ; 632 		if(IED.Err&	ERR_RELAY_FAIL)  	//0x2000,//继电器故障
2835  0067 c60021        	ld	a,_IED+4
2836  006a a520          	bcp	a,#32
2837  006c 2704          	jreq	L747
2838                     ; 633 			FeedRelayErr = 0; 
2840  006e 72130000      	bres	_SPIIO,#1
2841  0072               L747:
2842                     ; 634 		if(IED.Err&	ERR_BRAKE_POWER_FAIL)//0x4000 //逆变电源故障
2844  0072 c60021        	ld	a,_IED+4
2845  0075 a540          	bcp	a,#64
2846  0077 2704          	jreq	L157
2847                     ; 635 			FeedBrakePowerErr = 0;  
2849  0079 72110000      	bres	_SPIIO,#0
2850  007d               L157:
2851                     ; 636 		if(IED.Err&	ErrPhase)
2853  007d c60022        	ld	a,_IED+5
2854  0080 a501          	bcp	a,#1
2855  0082 270a          	jreq	L557
2856                     ; 637 			FeedErrPhaseLED = 0; 
2858  0084 72170000      	bres	_SPIIO,#3
2859  0088 2004          	jra	L557
2860  008a               L727:
2861                     ; 642 		SPI74HC164 = 0xFF; 
2863  008a 35ff0000      	mov	_SPIIO,#255
2864  008e               L557:
2865                     ; 644 }
2868  008e 81            	ret
2871                     	switch	.data
2872  0011               _SelftestTimer:
2873  0011 ff            	dc.b	255
2874  0012               _selftestcnt:
2875  0012 0004          	dc.w	4
2902                     ; 649 void SelfTest(void)
2902                     ; 650 { 
2903                     .text:	section	.text,new
2904  0000               _SelfTest:
2908                     ; 651  if(SelftestTimer==-1)
2910  0000 c60011        	ld	a,_SelftestTimer
2911  0003 a1ff          	cp	a,#255
2912  0005 2628          	jrne	L767
2913                     ; 653 	  Beep(3,500);
2915  0007 ae01f4        	ldw	x,#500
2916  000a 89            	pushw	x
2917  000b a603          	ld	a,#3
2918  000d cd0000        	call	_Beep
2920  0010 85            	popw	x
2921                     ; 654 		selftestcnt = 4;
2923  0011 ae0004        	ldw	x,#4
2924  0014 cf0012        	ldw	_selftestcnt,x
2925                     ; 655 		SelftestTimer = StartTimer(TIMER_MODE_CYCROUTINE,50L,TaskSelfTestLED,0); 
2927  0017 5f            	clrw	x
2928  0018 89            	pushw	x
2929  0019 ae0000        	ldw	x,#_TaskSelfTestLED
2930  001c 89            	pushw	x
2931  001d ae0032        	ldw	x,#50
2932  0020 89            	pushw	x
2933  0021 ae0000        	ldw	x,#0
2934  0024 89            	pushw	x
2935  0025 a602          	ld	a,#2
2936  0027 cd0000        	call	_StartTimer
2938  002a 5b08          	addw	sp,#8
2939  002c c70011        	ld	_SelftestTimer,a
2940  002f               L767:
2941                     ; 657 }
2944  002f 81            	ret
2987                     ; 661 void TaskSelfTestLED(void* param)
2987                     ; 662 { 
2988                     .text:	section	.text,new
2989  0000               _TaskSelfTestLED:
2993                     ; 663 	FeedMainPowerLED= !FeedMainPowerLED;
2995  0000 901e0002      	bcpl	_SPIIO+2,#7
2996                     ; 664 	FeedBatPowerLED	= !FeedBatPowerLED ;
2998  0004 901c0002      	bcpl	_SPIIO+2,#6
2999                     ; 665 	FeedMidLED = !FeedMidLED; 
3001  0008 90160002      	bcpl	_SPIIO+2,#3
3002                     ; 666 	FeedWarnLED	= !FeedWarnLED;
3004  000c 90180002      	bcpl	_SPIIO+2,#4
3005                     ; 667 	FeedDoorRun	= !FeedDoorRun;
3007  0010 90140002      	bcpl	_SPIIO+2,#2
3008                     ; 669 	SPI74HC164 = ~SPI74HC164;  
3010  0014 72530000      	cpl	_SPIIO
3011                     ; 670 	if(selftestcnt==0)
3013  0018 ce0012        	ldw	x,_selftestcnt
3014  001b 2628          	jrne	L7001
3015                     ; 672 		StopTimer(&SelftestTimer);
3017  001d ae0011        	ldw	x,#_SelftestTimer
3018  0020 cd0000        	call	_StopTimer
3020                     ; 673 		StopWarning();
3022  0023 cd0000        	call	_StopWarning
3024                     ; 674 		Beep(1,100);
3026  0026 ae0064        	ldw	x,#100
3027  0029 89            	pushw	x
3028  002a a601          	ld	a,#1
3029  002c cd0000        	call	_Beep
3031  002f 85            	popw	x
3032                     ; 675 		ActiveTask(TASK_FEED,1000L);
3034  0030 ae03e8        	ldw	x,#1000
3035  0033 89            	pushw	x
3036  0034 ae0000        	ldw	x,#0
3037  0037 89            	pushw	x
3038  0038 a609          	ld	a,#9
3039  003a cd0000        	call	_ActiveTask
3041  003d 5b04          	addw	sp,#4
3042                     ; 678 		selftestcnt = 4;
3044  003f ae0004        	ldw	x,#4
3045  0042 cf0012        	ldw	_selftestcnt,x
3046  0045               L7001:
3047                     ; 680 	if(selftestcnt==4)
3049  0045 ce0012        	ldw	x,_selftestcnt
3050  0048 a30004        	cpw	x,#4
3051  004b 2606          	jrne	L1101
3052                     ; 682 		SetWarningFreq(1000);
3054  004d ae03e8        	ldw	x,#1000
3055  0050 cd0000        	call	_SetWarningFreq
3057  0053               L1101:
3058                     ; 684 	selftestcnt--;
3060  0053 ce0012        	ldw	x,_selftestcnt
3061  0056 1d0001        	subw	x,#1
3062  0059 cf0012        	ldw	_selftestcnt,x
3063                     ; 685 } 
3066  005c 81            	ret
3103                     ; 689 void MotorDown(void *p)
3103                     ; 690 {
3104                     .text:	section	.text,new
3105  0000               _MotorDown:
3109                     ; 694 	MovMotor(POS_BOT);//启动全降信号
3111  0000 a602          	ld	a,#2
3112  0002 cd0000        	call	_MovMotor
3114                     ; 695 	IED.MotorMoveDelayTimerID = -1;
3116  0005 35ff0035      	mov	_IED+24,#255
3117                     ; 696 }
3120  0009 81            	ret
3157                     ; 698 void MotorUp(void *p)
3157                     ; 699 {
3158                     .text:	section	.text,new
3159  0000               _MotorUp:
3163                     ; 703 	MovMotor(POS_TOP);//启动全升信号
3165  0000 4f            	clr	a
3166  0001 cd0000        	call	_MovMotor
3168                     ; 704 	IED.MotorMoveDelayTimerID = -1;
3170  0004 35ff0035      	mov	_IED+24,#255
3171                     ; 705 }
3174  0008 81            	ret
4069                     	xdef	_selftestcnt
4070                     	xdef	_SelftestTimer
4071                     	switch	.bss
4072  0001               _preLEDRUN:
4073  0001 00            	ds.b	1
4074                     	xdef	_preLEDRUN
4075  0002               _preLEDWarn:
4076  0002 00            	ds.b	1
4077                     	xdef	_preLEDWarn
4078  0003               _preLEDBatPower:
4079  0003 00            	ds.b	1
4080                     	xdef	_preLEDBatPower
4081  0004               _preLEDMainPower:
4082  0004 00            	ds.b	1
4083                     	xdef	_preLEDMainPower
4084                     	xdef	_preIDMode
4085  0005               _PreEx2:
4086  0005 00            	ds.b	1
4087                     	xdef	_PreEx2
4088  0006               _PreEx1:
4089  0006 00            	ds.b	1
4090                     	xdef	_PreEx1
4091                     	xdef	_LowCnt
4092                     	xdef	_HiCnt
4093                     	xdef	f_TIM2_UPD_OVF_BRK_IRQHandler
4094  0007               _StopWarning_flag:
4095  0007 00            	ds.b	1
4096                     	xdef	_StopWarning_flag
4097                     	xdef	_ResumeCheckSensor
4098                     	xdef	_gcTimer_Motor_ID
4099  0008               _gcPhaseCtrl:
4100  0008 00            	ds.b	1
4101                     	xdef	_gcPhaseCtrl
4102                     	xdef	_gcMotorDir
4103                     	xdef	_gcNumBeep
4104                     	xdef	_gcBeepTrig
4105                     	xref	_Debug_time
4106                     	xdef	_Translate2
4107                     	xdef	_LED7Code
4108                     	xref	_Warning_flag
4109                     	xdef	_TaskSelfTestLED
4110                     	xref	_checkID
4111                     	xref	_ConvertDown
4112                     	xref	_EEReadStruct
4113                     	xref	_CheckBrakePower
4114                     	xref	_EnableBrakPower
4115                     	xref	_SetWarningFreq
4116                     	xref	_UNLockAllMotor
4117                     	xref	_LockAllMotor
4118                     	xref	_TIM2_ClearITPendingBit
4119                     	xref	_TIM2_SetCounter
4120                     	xref	_TIM2_ITConfig
4121                     	xref	_TIM2_Cmd
4122                     	xref	_TIM2_TimeBaseInit
4123                     	xref	_TIM2_DeInit
4124                     	xref	_StopTimer
4125                     	xref	_StartTimer
4126                     	xref	_SuspendTask
4127                     	xref	_ActiveTask
4128                     	xref	_BEEP_LSICalibrationConfig
4129                     	xref	_BEEP_Cmd
4130                     	xref	_BEEP_Init
4131                     	xdef	_abs
4132                     	xdef	_Task_SEG7
4133                     	xdef	_InitTim2
4134                     	xdef	_SelfTest
4135                     	xdef	_FeedErrFlash
4136                     	xdef	_Feed
4137                     	xdef	_MuteError
4138                     	xdef	_StopWarning
4139                     	xdef	_StartWarning
4140                     	xdef	_MotorUp
4141                     	xdef	_MotorDown
4142                     	xdef	_checkSetIDMode
4143                     	xdef	_EnableRunCtrl
4144                     	xdef	_TaskBeep
4145                     	xdef	_TaskFREQ
4146                     	xdef	_TaskCheckPhase
4147                     	xdef	_TaskStopMotor
4148                     	xdef	_MovMotor
4149                     	xdef	_MotorDelay
4150                     	xdef	_GetCurretPos
4151                     	xdef	_TaskWarn
4152                     	xdef	_ErrStopMotor
4153                     	xdef	_StopMotor
4154                     	xdef	_StopBeep
4155                     	xdef	_Beep
4156                     	xdef	_InitBeep
4157                     	xdef	_Receive
4158                     	xdef	_Translate
4159                     	xdef	_UpdateIO
4160  0009               _TimeOut:
4161  0009 000000000000  	ds.b	20
4162                     	xdef	_TimeOut
4163  001d               _IED:
4164  001d 000000000000  	ds.b	30
4165                     	xdef	_IED
4166                     	xdef	_SPIIO
4167                     	xref	_GPIO_ReadInputPin
4168                     	xref	_GPIO_WriteLow
4169                     	xref	_GPIO_WriteHigh
4170                     	xref.b	c_lreg
4171                     	xref.b	c_x
4172                     	xref.b	c_y
4192                     	xref	c_imul
4193                     	xref	c_lcmp
4194                     	xref	c_lmod
4195                     	xref	c_ladd
4196                     	xref	c_rtol
4197                     	xref	c_uitolx
4198                     	xref	c_itolx
4199                     	xref	c_lrzmp
4200                     	xref	c_ldiv
4201                     	xref	c_lsbc
4202                     	xref	c_ltor
4203                     	xref	c_smodx
4204                     	xref	c_sdivx
4205                     	end
