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

📄 ds1822_measure.asm

📁 web51的开发库
💻 ASM
字号:
	.global ds1822_measure	.section cpu_dir, #alloc	.word   'd'+'s'+'1'+'8'+'2'+'2'+'_'+'m'+'e'+'a'+'s'+'u'+'r'+'e'+'.'+'c'+'g'+'i'	.byte   0x10		  ;cgi	.byte   0 		  ;reserved	.word   cgibegin	.word   cgiend	.section cpu_files, #alloccgibegin:			;ds1822_a.cgiw	.pcode ds1822_measure	.pcode pretcgiend:	.textds1822_measure:	mov	DPTR,#DS1822_chips	;CHIP adres offset by parametr in .HTML code	mov	A,state80		;Offset is mutliple by 8 not by 6 !	add	A,DPL	mov	DPL,Acc	mov	A,DPH	addc	A,#0			;+Carry id there are DPL overflow	mov	DPH,A	lcall	getDS1822_MULTI		;Jump over routine if there are no temperature chip on bus	jc	No_chip	mov	a,tempDS1822MSB	jb	Acc.7,DS1822_minus	;Sign polarity detection	mov	A,#'+'	sjmp	Ds1822_send_signDS1822_minus:	mov	A,#'-'Ds1822_send_sign:	lcall	sendchar	mov	A,#' '	lcall	sendchar	mov	R6,tempDS1822MSB	mov	R7,tempDS1822LSB	mov	A,R6	jnb	Acc.7,DS1822_pls	;Sign polarity detection	mov	a,R7	cpl	A
			;one's complement	add	A,#1			;two complement	mov	R7,A	mov	a,R6	cpl	A
			;one's complement	addc	A,#0			;two complement	mov	R6,A

DS1822_pls:	mov	a,R7	push	Acc			;push LSB	swap	A	anl	A,#0x0F	mov	R7,A	mov	a,R6	swap	A	anl	A,#0x70	orl	A,R7	lcall	sendDecb
	mov	A,#'.'	lcall	sendchar	pop	Acc			;pop LSB	anl	A,#0x0F			;Chip result is 16/10 of degree in A	mov	B,#10			;(A*10)/16 => tenths of 癈 in ACC	mul	AB	swap	A	anl	A,#0x0F	ljmp	sendDecbNo_chip:	lcall	send_string        .asciz	"Chip not found on 1wire bus."	ret	;; end

⌨️ 快捷键说明

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