   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Parser V4.12.9 - 19 Apr 2023
   3                     ; Generator (Limited) V4.5.6 - 18 Jul 2023
  49                     ; 14 void Init_Power_Check(void)
  49                     ; 15 { 
  51                     .text:	section	.text,new
  52  0000               _Init_Power_Check:
  56                     ; 17     GPIO_Init(GPIOB, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|
  56                     ; 18 					GPIO_PIN_4|GPIO_PIN_5, GPIO_MODE_IN_FL_NO_IT); 
  58  0000 4b00          	push	#0
  59  0002 4b3f          	push	#63
  60  0004 ae5005        	ldw	x,#20485
  61  0007 cd0000        	call	_GPIO_Init
  63  000a 85            	popw	x
  64                     ; 19     ADC1_DeInit();
  66  000b cd0000        	call	_ADC1_DeInit
  68                     ; 20 		ADC1_Init(ADC1_CONVERSIONMODE_SINGLE, ADC1_CHANNEL_0, 
  68                     ; 21 				ADC1_PRESSEL_FCPU_D18, ADC1_EXTTRIG_TIM, DISABLE, 
  68                     ; 22 				ADC1_ALIGN_RIGHT, 
  68                     ; 23 				ADC1_SCHMITTTRIG_ALL, DISABLE); 
  70  000e 4b00          	push	#0
  71  0010 4bff          	push	#255
  72  0012 4b08          	push	#8
  73  0014 4b00          	push	#0
  74  0016 4b00          	push	#0
  75  0018 4b70          	push	#112
  76  001a 5f            	clrw	x
  77  001b cd0000        	call	_ADC1_Init
  79  001e 5b06          	addw	sp,#6
  80                     ; 24 		ADC1_ITConfig(ADC1_IT_EOCIE,ENABLE); 
  82  0020 4b01          	push	#1
  83  0022 ae0020        	ldw	x,#32
  84  0025 cd0000        	call	_ADC1_ITConfig
  86  0028 84            	pop	a
  87                     ; 25     ADC1_StartConversion();
  89  0029 cd0000        	call	_ADC1_StartConversion
  91                     ; 26 }
  94  002c 81            	ret
  97                     	switch	.data
  98  0000               _gcChannel:
  99  0000 00            	dc.b	0
 100  0001               _cvtCnt:
 101  0001 00            	dc.b	0
 138                     ; 33 @far @interrupt void ADC1_IRQHandler(void)
 138                     ; 34 #else // _RAISONANCE_ 
 138                     ; 35 void ADC1_IRQHandler(void) interrupt 22
 138                     ; 36 #endif // _COSMIC_ 
 138                     ; 37 { 	
 140                     .text:	section	.text,new
 141  0000               f_ADC1_IRQHandler:
 143  0000 8a            	push	cc
 144  0001 84            	pop	a
 145  0002 a4bf          	and	a,#191
 146  0004 88            	push	a
 147  0005 86            	pop	cc
 148       00000002      OFST:	set	2
 149  0006 3b0002        	push	c_x+2
 150  0009 be00          	ldw	x,c_x
 151  000b 89            	pushw	x
 152  000c 3b0002        	push	c_y+2
 153  000f be00          	ldw	x,c_y
 154  0011 89            	pushw	x
 155  0012 89            	pushw	x
 158                     ; 40     Conversion_Value = ADC1_GetConversionValue(); 
 160  0013 cd0000        	call	_ADC1_GetConversionValue
 162  0016 1f01          	ldw	(OFST-1,sp),x
 164                     ; 41     ADC1_ClearITPendingBit(ADC1_IT_EOC);
 166  0018 ae0080        	ldw	x,#128
 167  001b cd0000        	call	_ADC1_ClearITPendingBit
 169                     ; 42 		if(cvtCnt>4)
 171  001e c60001        	ld	a,_cvtCnt
 172  0021 a105          	cp	a,#5
 173  0023 2538          	jrult	L53
 174                     ; 44 			cvtCnt = 0;
 176  0025 725f0001      	clr	_cvtCnt
 177                     ; 45 			AD_Value[gcChannel] = Conversion_Value;
 179  0029 c60000        	ld	a,_gcChannel
 180  002c 5f            	clrw	x
 181  002d 97            	ld	xl,a
 182  002e 58            	sllw	x
 183  002f 1601          	ldw	y,(OFST-1,sp)
 184  0031 df0000        	ldw	(_AD_Value,x),y
 185                     ; 47 			gcChannel++; 
 187  0034 725c0000      	inc	_gcChannel
 188                     ; 48 			gcChannel = gcChannel%M;
 190  0038 c60000        	ld	a,_gcChannel
 191  003b 5f            	clrw	x
 192  003c 97            	ld	xl,a
 193  003d a606          	ld	a,#6
 194  003f 62            	div	x,a
 195  0040 5f            	clrw	x
 196  0041 97            	ld	xl,a
 197  0042 01            	rrwa	x,a
 198  0043 c70000        	ld	_gcChannel,a
 199  0046 02            	rlwa	x,a
 200                     ; 49 			ADC1_Init(ADC1_CONVERSIONMODE_SINGLE, gcChannel, 
 200                     ; 50 				ADC1_PRESSEL_FCPU_D18, ADC1_EXTTRIG_TIM, DISABLE, 
 200                     ; 51 				ADC1_ALIGN_RIGHT, 
 200                     ; 52 				ADC1_SCHMITTTRIG_ALL, DISABLE); 
 202  0047 4b00          	push	#0
 203  0049 4bff          	push	#255
 204  004b 4b08          	push	#8
 205  004d 4b00          	push	#0
 206  004f 4b00          	push	#0
 207  0051 4b70          	push	#112
 208  0053 c60000        	ld	a,_gcChannel
 209  0056 5f            	clrw	x
 210  0057 97            	ld	xl,a
 211  0058 cd0000        	call	_ADC1_Init
 213  005b 5b06          	addw	sp,#6
 214  005d               L53:
 215                     ; 55 		ADC1_StartConversion();
 217  005d cd0000        	call	_ADC1_StartConversion
 219                     ; 56 		cvtCnt++;
 221  0060 725c0001      	inc	_cvtCnt
 222                     ; 57 } 
 225  0064 5b02          	addw	sp,#2
 226  0066 85            	popw	x
 227  0067 bf00          	ldw	c_y,x
 228  0069 320002        	pop	c_y+2
 229  006c 85            	popw	x
 230  006d bf00          	ldw	c_x,x
 231  006f 320002        	pop	c_x+2
 232  0072 80            	iret
 270                     	xdef	f_ADC1_IRQHandler
 271                     	xdef	_cvtCnt
 272                     	xdef	_gcChannel
 273                     	xdef	_Init_Power_Check
 274                     	switch	.bss
 275  0000               _AD_Value:
 276  0000 000000000000  	ds.b	12
 277                     	xdef	_AD_Value
 278                     	xref	_GPIO_Init
 279                     	xref	_ADC1_ClearITPendingBit
 280                     	xref	_ADC1_GetConversionValue
 281                     	xref	_ADC1_StartConversion
 282                     	xref	_ADC1_ITConfig
 283                     	xref	_ADC1_Init
 284                     	xref	_ADC1_DeInit
 285                     	xref.b	c_x
 286                     	xref.b	c_y
 306                     	end
