2018.6.21 HOLTEK HT49R70A-1 Source Code analysis

Cange note:

  

 “Reading TMR1H will latch the contents of TMR1H and TMR1L counter to the destination”? For example < MOV a,TMR1H >, but accumulator only 8-bit, how can latch TMR1H and TMR1L

Read_Temp:
IFNDEF	RELEASE_VERSION
	mov	a,lastram
	mov	temperature,a	;store calculated temperatur (table pos.)
	ret	
ENDIF
	snz	flag3.f_read_temp
	;jmp	read_temp_end  
    ret                     ;V05_Joey

	clr	flag3.f_read_temp
	mov	a,4	
	mov	temploop,a
	clr	ntcl
	clr	ntch
loop_ntc:
	clr	EMI 		;disable all interrupts
		
	set	outa.RV		;set all I/Os in normal pos
	set	outa.NTC
	clr	outa.TR
	set	outa.RS
	mov	a,outa
	mov	PA,a

	call	delay_100us	;time to discharge cap
	clr	TMR1
	clr	TMR0		
	set	TMR1C.4		;enable TMR1
	set	TMR0C.4 		;enable TMR0
	
	clr	outa.NTC		;now test NTC time
	set	outa.TR
	mov	a,outa
	mov	PA,a

	nop
	nop
wait_AD_NTC:
	sz	PA.Rs	;
	jmp	wait_AD_NTC
	clr	TMR0C.4 ;disable TMR0	
	clr	TMR1C.4 ;disable TMR1

	set	outa.NTC		;discarge cap
	clr	outa.TR
	mov	a,outa
	mov	PA,a

	mov	a,TMR0
	addm 	a,ntcl
	mov	a,TMR1
	adcm	a,ntch
	dec	temploop
	snz	z
	jmp	loop_ntc
	clr	c
	rrc	ntch
	rrc	ntcl	;NTC / 2
	clr	c
	rrc	ntch	
	rrc	ntcl	;NTC / 4

  

 

猜你喜欢

转载自www.cnblogs.com/huangbaobaoi/p/9210106.html
今日推荐