   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Parser V4.12.9 - 19 Apr 2023
   3                     ; Generator (Limited) V4.5.6 - 18 Jul 2023
  16                     	switch	.data
  17  0000               _Company:
  18  0000 0008          	dc.w	L3
  60                     ; 17 void InitTestCoil(void* p)
  60                     ; 18 { 
  62                     .text:	section	.text,new
  63  0000               _InitTestCoil:
  67                     ; 19 	EnableBrakPower(FALSE);
  69  0000 4f            	clr	a
  70  0001 cd0000        	call	_EnableBrakPower
  72                     ; 20 }
  75  0004 81            	ret
 121                     ; 23 main()
 121                     ; 24 {  
 122                     .text:	section	.text,new
 123  0000               _main:
 127                     ; 25 	Disable(); 
 130  0000 9b            sim
 132                     ; 27 	InitBeep();  
 134  0001 cd0000        	call	_InitBeep
 136                     ; 28 	InitPort();
 138  0004 cd0000        	call	_InitPort
 140                     ; 30 	Init_task();
 142  0007 cd0000        	call	_Init_task
 144                     ; 31 	InitIED();
 146  000a cd0000        	call	_InitIED
 148                     ; 39 	InitSPI();
 150  000d cd0000        	call	_InitSPI
 152                     ; 40 	EnableBattary(); 
 154  0010 cd0000        	call	_EnableBattary
 156                     ; 41 	InitDC2AC(0); 
 158  0013 5f            	clrw	x
 159  0014 cd0000        	call	_InitDC2AC
 161                     ; 44 	StopDC2ACConvert(0); 
 163  0017 5f            	clrw	x
 164  0018 cd0000        	call	_StopDC2ACConvert
 166                     ; 47 	Init_Power_Check();	 
 168  001b cd0000        	call	_Init_Power_Check
 170                     ; 49 	StopBeep(); 
 172  001e cd0000        	call	_StopBeep
 174                     ; 52 	SelfTest();
 176  0021 cd0000        	call	_SelfTest
 178                     ; 53 	LockAllMotor(); 
 180  0024 cd0000        	call	_LockAllMotor
 182                     ; 54 	StopMotor();
 184  0027 cd0000        	call	_StopMotor
 186                     ; 55 	InitTim2();
 188  002a cd0000        	call	_InitTim2
 190                     ; 56 	UpdateIO(); 
 192  002d cd0000        	call	_UpdateIO
 194                     ; 57 	InitModbus();
 196  0030 cd0000        	call	_InitModbus
 198                     ; 58 	checkSetIDMode();
 200  0033 cd0000        	call	_checkSetIDMode
 202                     ; 60 	IWDG_Enable();
 204  0036 cd0000        	call	_IWDG_Enable
 206                     ; 62 	IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
 208  0039 a655          	ld	a,#85
 209  003b cd0000        	call	_IWDG_WriteAccessCmd
 211                     ; 64 	IWDG_SetPrescaler(IWDG_Prescaler_256);
 213  003e a606          	ld	a,#6
 214  0040 cd0000        	call	_IWDG_SetPrescaler
 216                     ; 66 	IWDG_SetReload(0xFF);
 218  0043 a6ff          	ld	a,#255
 219  0045 cd0000        	call	_IWDG_SetReload
 221                     ; 68 	IWDG_ReloadCounter();
 223  0048 cd0000        	call	_IWDG_ReloadCounter
 225                     ; 69 	Enable(); 
 228  004b 9a            rim
 230  004c               L14:
 231                     ; 72 		TaskProc();
 233  004c cd0000        	call	_TaskProc
 236  004f 20fb          	jra	L14
 260                     ; 76 void InitPort(void)
 260                     ; 77 { 
 261                     .text:	section	.text,new
 262  0000               _InitPort:
 266                     ; 78 		GPIO_Init(GPIOB,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5,GPIO_MODE_IN_FL_NO_IT); 
 268  0000 4b00          	push	#0
 269  0002 4b3f          	push	#63
 270  0004 ae5005        	ldw	x,#20485
 271  0007 cd0000        	call	_GPIO_Init
 273  000a 85            	popw	x
 274                     ; 80 		GPIO_Init(GPIOC,GPIO_PIN_7,GPIO_MODE_IN_FL_NO_IT);  
 276  000b 4b00          	push	#0
 277  000d 4b80          	push	#128
 278  000f ae500a        	ldw	x,#20490
 279  0012 cd0000        	call	_GPIO_Init
 281  0015 85            	popw	x
 282                     ; 82 		GPIO_Init(GPIOC,GPIO_PIN_3,GPIO_MODE_OUT_OD_HIZ_FAST);     //LIN 
 284  0016 4bb0          	push	#176
 285  0018 4b08          	push	#8
 286  001a ae500a        	ldw	x,#20490
 287  001d cd0000        	call	_GPIO_Init
 289  0020 85            	popw	x
 290                     ; 85 		GPIO_Init(GPIOC,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6,GPIO_MODE_OUT_PP_HIGH_FAST); 
 292  0021 4bf0          	push	#240
 293  0023 4b76          	push	#118
 294  0025 ae500a        	ldw	x,#20490
 295  0028 cd0000        	call	_GPIO_Init
 297  002b 85            	popw	x
 298                     ; 87 		GPIO_Init(GPIOD,GPIO_PIN_6|GPIO_PIN_5,GPIO_MODE_IN_FL_NO_IT);  		
 300  002c 4b00          	push	#0
 301  002e 4b60          	push	#96
 302  0030 ae500f        	ldw	x,#20495
 303  0033 cd0000        	call	_GPIO_Init
 305  0036 85            	popw	x
 306                     ; 88 		GPIO_Init(GPIOD,GPIO_PIN_0|GPIO_PIN_1,GPIO_MODE_OUT_PP_HIGH_FAST);  
 308  0037 4bf0          	push	#240
 309  0039 4b03          	push	#3
 310  003b ae500f        	ldw	x,#20495
 311  003e cd0000        	call	_GPIO_Init
 313  0041 85            	popw	x
 314                     ; 89 		GPIO_Init(GPIOD,GPIO_PIN_7,GPIO_MODE_OUT_PP_HIGH_FAST);  
 316  0042 4bf0          	push	#240
 317  0044 4b80          	push	#128
 318  0046 ae500f        	ldw	x,#20495
 319  0049 cd0000        	call	_GPIO_Init
 321  004c 85            	popw	x
 322                     ; 90 		GPIO_Init(GPIOD,GPIO_PIN_4,GPIO_MODE_IN_FL_NO_IT);  
 324  004d 4b00          	push	#0
 325  004f 4b10          	push	#16
 326  0051 ae500f        	ldw	x,#20495
 327  0054 cd0000        	call	_GPIO_Init
 329  0057 85            	popw	x
 330                     ; 91 		GPIO_Init(GPIOD,GPIO_PIN_2|GPIO_PIN_3,GPIO_MODE_IN_FL_NO_IT); 
 332  0058 4b00          	push	#0
 333  005a 4b0c          	push	#12
 334  005c ae500f        	ldw	x,#20495
 335  005f cd0000        	call	_GPIO_Init
 337  0062 85            	popw	x
 338                     ; 92 		GPIO_Init(GPIOF,GPIO_PIN_4,GPIO_MODE_OUT_PP_LOW_FAST); 
 340  0063 4be0          	push	#224
 341  0065 4b10          	push	#16
 342  0067 ae5019        	ldw	x,#20505
 343  006a cd0000        	call	_GPIO_Init
 345  006d 85            	popw	x
 346                     ; 94 		GPIO_Init(GPIOA,GPIO_PIN_1|GPIO_PIN_1,GPIO_MODE_IN_PU_NO_IT);  
 348  006e 4b40          	push	#64
 349  0070 4b02          	push	#2
 350  0072 ae5000        	ldw	x,#20480
 351  0075 cd0000        	call	_GPIO_Init
 353  0078 85            	popw	x
 354                     ; 95 		GPIO_Init(GPIOA,GPIO_PIN_2,GPIO_MODE_OUT_PP_HIGH_FAST);
 356  0079 4bf0          	push	#240
 357  007b 4b04          	push	#4
 358  007d ae5000        	ldw	x,#20480
 359  0080 cd0000        	call	_GPIO_Init
 361  0083 85            	popw	x
 362                     ; 96 }
 365  0084 81            	ret
 389                     ; 99 @far @interrupt void EXTI_PORTD_IRQHandler(void)
 389                     ; 100 #else // _RAISONANCE_ 
 389                     ; 101 void EXTI_PORTD_IRQHandler(void) interrupt 6
 389                     ; 102 #endif // _COSMIC_ 
 389                     ; 103 {
 391                     .text:	section	.text,new
 392  0000               f_EXTI_PORTD_IRQHandler:
 396                     ; 105 }
 399  0000 80            	iret
 425                     .const:	section	.text
 426  0000               L61:
 427  0000 000026b7      	dc.l	9911
 428  0004               L02:
 429  0004 0000000a      	dc.l	10
 430                     ; 109 void InitIED(void)
 430                     ; 110 {
 431                     	scross	off
 432                     .text:	section	.text,new
 433  0000               _InitIED:
 437                     ; 116 	IED.Err        |= ErrPhase;	    
 439  0000 72100005      	bset	_IED+5,#0
 440                     ; 117 	IED.cPos			  = POS_UNKNOWN;     
 442  0004 35030001      	mov	_IED+1,#3
 443                     ; 119 	IED.MotorMoveDelayTimerID = -1; 
 445  0008 35ff0018      	mov	_IED+24,#255
 446                     ; 120 	IED.BrakeDelayTimerID = -1;
 448  000c 35ff0019      	mov	_IED+25,#255
 449                     ; 121 	EEReadStruct(&IED.nId ,sizeof(IED.nId)/sizeof(char),0);  
 451  0010 5f            	clrw	x
 452  0011 89            	pushw	x
 453  0012 ae0001        	ldw	x,#1
 454  0015 89            	pushw	x
 455  0016 ae0000        	ldw	x,#_IED
 456  0019 cd0000        	call	_EEReadStruct
 458  001c 5b04          	addw	sp,#4
 459                     ; 122 	SetID();
 461  001e cd0000        	call	_SetID
 463                     ; 123 	EEReadStruct(&IED.MidTimeWait ,sizeof(IED.MidTimeWait)/sizeof(char),1);
 465  0021 ae0001        	ldw	x,#1
 466  0024 89            	pushw	x
 467  0025 ae0004        	ldw	x,#4
 468  0028 89            	pushw	x
 469  0029 ae0014        	ldw	x,#_IED+20
 470  002c cd0000        	call	_EEReadStruct
 472  002f 5b04          	addw	sp,#4
 473                     ; 124 	if((IED.MidTimeWait>9910)||(IED.MidTimeWait<10))
 475  0031 9c            	rvf
 476  0032 ae0014        	ldw	x,#_IED+20
 477  0035 cd0000        	call	c_ltor
 479  0038 ae0000        	ldw	x,#L61
 480  003b cd0000        	call	c_lcmp
 482  003e 2e0f          	jrsge	L77
 484  0040 9c            	rvf
 485  0041 ae0014        	ldw	x,#_IED+20
 486  0044 cd0000        	call	c_ltor
 488  0047 ae0004        	ldw	x,#L02
 489  004a cd0000        	call	c_lcmp
 491  004d 2e1c          	jrsge	L57
 492  004f               L77:
 493                     ; 126 		 IED.MidTimeWait=10L;
 495  004f ae000a        	ldw	x,#10
 496  0052 cf0016        	ldw	_IED+22,x
 497  0055 ae0000        	ldw	x,#0
 498  0058 cf0014        	ldw	_IED+20,x
 499                     ; 127 		 EEWriteStruct(&IED.MidTimeWait ,sizeof(IED.MidTimeWait)/sizeof(char),1); 
 501  005b ae0001        	ldw	x,#1
 502  005e 89            	pushw	x
 503  005f ae0004        	ldw	x,#4
 504  0062 89            	pushw	x
 505  0063 ae0014        	ldw	x,#_IED+20
 506  0066 cd0000        	call	_EEWriteStruct
 508  0069 5b04          	addw	sp,#4
 509  006b               L57:
 510                     ; 130 }
 513  006b 81            	ret
 538                     	xdef	f_EXTI_PORTD_IRQHandler
 539                     	xdef	_main
 540                     	xdef	_InitTestCoil
 541                     	xdef	_Company
 542                     	xref	_SetID
 543                     	xref	_InitModbus
 544                     	xref	_EEReadStruct
 545                     	xref	_EEWriteStruct
 546                     	xref	_EnableBattary
 547                     	xref	_EnableBrakPower
 548                     	xref	_StopDC2ACConvert
 549                     	xref	_InitDC2AC
 550                     	xref	_LockAllMotor
 551                     	xref	_Init_Power_Check
 552                     	xdef	_InitIED
 553                     	xdef	_InitPort
 554                     	xref	_InitTim2
 555                     	xref	_SelfTest
 556                     	xref	_checkSetIDMode
 557                     	xref	_StopMotor
 558                     	xref	_StopBeep
 559                     	xref	_InitBeep
 560                     	xref	_UpdateIO
 561                     	xref	_IED
 562                     	xref	_InitSPI
 563                     	xref	_GPIO_Init
 564                     	xref	_Init_task
 565                     	xref	_TaskProc
 566                     	xref	_IWDG_Enable
 567                     	xref	_IWDG_ReloadCounter
 568                     	xref	_IWDG_SetReload
 569                     	xref	_IWDG_SetPrescaler
 570                     	xref	_IWDG_WriteAccessCmd
 571                     	switch	.const
 572  0008               L3:
 573  0008 436f2e4c7464  	dc.b	"Co.Ltd    ",10,0
 593                     	xref	c_lcmp
 594                     	xref	c_ltor
 595                     	end
