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

📄 main.ls

📁 STM8s
💻 LS
字号:
   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Generator V4.2.8 - 03 Dec 2008
   4                     	bsct
   5  0000               _i:
   6  0000 0a            	dc.b	10
  55                     ; 17 void delay_ms(u16 aa)
  55                     ; 18 {
  57                     	switch	.text
  58  0000               _delay_ms:
  60  0000 89            	pushw	x
  61  0001 89            	pushw	x
  62       00000002      OFST:	set	2
  65  0002 2014          	jra	L53
  66  0004               L33:
  67                     ; 21 {int j=140;
  69  0004 ae008c        	ldw	x,#140
  70  0007 1f01          	ldw	(OFST-1,sp),x
  72  0009               L54:
  73                     ; 22 while(j--);
  75  0009 1e01          	ldw	x,(OFST-1,sp)
  76  000b 1d0001        	subw	x,#1
  77  000e 1f01          	ldw	(OFST-1,sp),x
  78  0010 1c0001        	addw	x,#1
  79  0013 a30000        	cpw	x,#0
  80  0016 26f1          	jrne	L54
  81  0018               L53:
  82                     ; 20 while(aa--)
  84  0018 1e03          	ldw	x,(OFST+1,sp)
  85  001a 1d0001        	subw	x,#1
  86  001d 1f03          	ldw	(OFST+1,sp),x
  87  001f 1c0001        	addw	x,#1
  88  0022 a30000        	cpw	x,#0
  89  0025 26dd          	jrne	L33
  90                     ; 24 }
  93  0027 5b04          	addw	sp,#4
  94  0029 81            	ret
 129                     .const:	section	.text
 130  0000               L01:
 131  0000 000025e4      	dc.l	9700
 132                     ; 27 void main()
 132                     ; 28 {  
 133                     	switch	.text
 134  002a               _main:
 138                     ; 35   UART2_DeInit();
 140  002a cd0000        	call	_UART2_DeInit
 142                     ; 37 	UART2_Init(38400,UART2_WORDLENGTH_8D,UART2_STOPBITS_1,UART2_PARITY_NO, UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TX_ENABLE);
 144  002d 4b04          	push	#4
 145  002f 4b80          	push	#128
 146  0031 4b00          	push	#0
 147  0033 4b00          	push	#0
 148  0035 4b00          	push	#0
 149  0037 ae9600        	ldw	x,#38400
 150  003a 89            	pushw	x
 151  003b ae0000        	ldw	x,#0
 152  003e 89            	pushw	x
 153  003f cd0000        	call	_UART2_Init
 155  0042 5b09          	addw	sp,#9
 156                     ; 39 		putStrLine("Yes,The serialport is ok !");
 158  0044 ae000a        	ldw	x,#L16
 159  0047 cd0000        	call	_putStrLine
 161                     ; 41 	  ADC1_DeInit();
 163  004a cd0000        	call	_ADC1_DeInit
 165                     ; 43 	ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS,ADC1_CHANNEL_9,ADC1_PRESSEL_FCPU_D18,ADC1_EXTTRIG_TIM,DISABLE,ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL9, DISABLE);
 167  004d 4b00          	push	#0
 168  004f 4b09          	push	#9
 169  0051 4b08          	push	#8
 170  0053 4b00          	push	#0
 171  0055 4b00          	push	#0
 172  0057 4b70          	push	#112
 173  0059 ae0009        	ldw	x,#9
 174  005c a601          	ld	a,#1
 175  005e 95            	ld	xh,a
 176  005f cd0000        	call	_ADC1_Init
 178  0062 5b06          	addw	sp,#6
 179                     ; 47 	ADC1_StartConversion();
 181  0064 cd0000        	call	_ADC1_StartConversion
 183                     ; 50 		t=ADC1_GetConversionValue();
 185  0067 cd0000        	call	_ADC1_GetConversionValue
 187  006a cd0000        	call	c_uitolx
 189  006d ae0000        	ldw	x,#_t
 190  0070 cd0000        	call	c_rtol
 192  0073               L36:
 193                     ; 65 		t=ADC1_GetConversionValue();
 195  0073 cd0000        	call	_ADC1_GetConversionValue
 197  0076 cd0000        	call	c_uitolx
 199  0079 ae0000        	ldw	x,#_t
 200  007c cd0000        	call	c_rtol
 202                     ; 68     putInt((((u32)1024*(u32)9700)/t-9700));//   t/1024=10000/(10000+x);  x-阻值
 204  007f ae9000        	ldw	x,#36864
 205  0082 bf02          	ldw	c_lreg+2,x
 206  0084 ae0097        	ldw	x,#151
 207  0087 bf00          	ldw	c_lreg,x
 208  0089 ae0000        	ldw	x,#_t
 209  008c cd0000        	call	c_ludv
 211  008f ae0000        	ldw	x,#L01
 212  0092 cd0000        	call	c_lsub
 214  0095 be02          	ldw	x,c_lreg+2
 215  0097 89            	pushw	x
 216  0098 be00          	ldw	x,c_lreg
 217  009a 89            	pushw	x
 218  009b cd0000        	call	_putInt
 220  009e 5b04          	addw	sp,#4
 221                     ; 69 		putStr("     ");
 223  00a0 ae0004        	ldw	x,#L76
 224  00a3 cd0000        	call	_putStr
 226                     ; 71     putIntLine(t);
 228  00a6 be02          	ldw	x,_t+2
 229  00a8 89            	pushw	x
 230  00a9 be00          	ldw	x,_t
 231  00ab 89            	pushw	x
 232  00ac cd0000        	call	_putIntLine
 234  00af 5b04          	addw	sp,#4
 235                     ; 72 		 delay_ms(500);
 237  00b1 ae01f4        	ldw	x,#500
 238  00b4 cd0000        	call	_delay_ms
 241  00b7 20ba          	jra	L36
 283                     	xdef	_main
 284                     	xdef	_delay_ms
 285                     	switch	.ubsct
 286  0000               _t:
 287  0000 00000000      	ds.b	4
 288                     	xdef	_t
 289                     	xdef	_i
 290  0004               _r:
 291  0004 0000          	ds.b	2
 292                     	xdef	_r
 293                     	xref	_putIntLine
 294                     	xref	_putInt
 295                     	xref	_putStrLine
 296                     	xref	_putStr
 297                     	xref	_UART2_Init
 298                     	xref	_UART2_DeInit
 299                     	xref	_ADC1_GetConversionValue
 300                     	xref	_ADC1_StartConversion
 301                     	xref	_ADC1_Init
 302                     	xref	_ADC1_DeInit
 303                     	switch	.const
 304  0004               L76:
 305  0004 202020202000  	dc.b	"     ",0
 306  000a               L16:
 307  000a 5965732c5468  	dc.b	"Yes,The serialport"
 308  001c 206973206f6b  	dc.b	" is ok !",0
 309                     	xref.b	c_lreg
 310                     	xref.b	c_x
 330                     	xref	c_lsub
 331                     	xref	c_ludv
 332                     	xref	c_rtol
 333                     	xref	c_uitolx
 334                     	end

⌨️ 快捷键说明

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