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

📄 powerset.asm

📁 应用松翰母体写的一款电磁炉
💻 ASM
字号:
;********************************************************
;  PROJECT NAME : nimh charger				*
;  Author	: borg					*
;  VERSION	: V0.0			      		*
;  BODY		: SN8P2704a				*
;  COMPILER	: 1.99N					*
;  function	:					*
;  input	:					*
;  output	: tempvolt1_l, tempvolt1_h		*
;		  tempvolt2_l, tempvolt2_h		*
;  use register	: data1, data2, tempvolt1_l, tempvolt1_h*
;		  tempvolt2_l, tempvolt2_h		*
;  use flag	: dtemp1_f, dtemp2_f			*
;  run cycles	: 					*
; *******************************************************
mnpowerset:
	b0bts1	power_test_f
	jmp	mnpowerset90
mnpowerset10:
	bclr	power_test_f
	
	mov	a,#0ffh
	mov	tc0r,a

	call	delay1ms
	
	call	mnvoltage
	nop
	call	mncurrent
	nop
	call	mnpower
	nop
	mov	a,power_l
	mov	power_max_l,a
	mov	a,power_h
	mov	power_max_h,a
	
	mov	a,#00h
	mov	tc0r,a
	
	call	delay1ms
	
	call	mnvoltage
	nop
	call	mncurrent
	nop
	call	mnpower
	nop
	mov	a,power_l
	mov	power_min_l,a
	mov	a,power_h
	mov	power_min_h,a
	
	mov	a,power_max_l
	sub	a,power_min_l
	mov	result0,a
	mov	a,power_max_h
	sub	a,power_min_h
	mov	result1,a
	
	mov	a,#50
	mov	divisor0,a
	clr	divisor1
	
	call	divsub
	
	mov	a,result0
	mov	step_l,a
	mov	a,result1
	mov	step_h,a
	
	mov	a,power_set_l
	sub	a,power_min_l
	mov	result0,a
	mov	a,power_set_h
	sbc	a,power_min_h
	mov	result1,a
	
	mov	a,step_l
	mov	divisor0,a
	mov	a,step_h
	mov	divisor1,a
	
	call	divsub
	
	mov	a,result0
	mov	step_count_l,a
	mov	multiplier_l,a
	mov	a,result1
	mov	step_count_h,a
	mov	multiplier_h,a
	
	mov	a,#5
	mov	multiplicand_l,a
	clr	multiplicand_h
	
	call	mul2x2
	
	mov	a,result1
	mov	tc0r_copy,a
	mov	tc0r,a
;---------------------------------------
delay1ms:
	mov	a,#100
	mov	temp0,a
delay10us:
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	decms	temp0
	jmp	delay10us
	ret
;***************************************************
;Name;DIV_4D4
;Function:
;Input:dividend0,dividend1,dividend2,dividend3,divisor0,divisor1,divisor2,divisor3
;Output:result0,result1,result2,result3
;Ram:temp0,temp1
;SUB:
;***************************************************
DIVSUB:
DIV_4D4:
       MOV    		A,#16
       B0MOV  		temp0,A

       clr    		dividend0
       clr    		dividend1
       CLC  
DIV4_LP:      		  ;      被除数左移一位到BUFFER? 
    		
       RLCM   		result0
       RLCM   		result1
              		
       RLCM   		dividend0
       RLCM   		dividend1

;--------------------------------------------------
;      BUFFER 中之值减去除数。  
;--------------------------------------------------

       B0MOV    	A,dividend0
       SUB      	A,divisor0
       B0MOV    	temp1,A    

       B0MOV    	A,dividend1
       Sbc      	A,divisor1
       B0MOV    	temp2,A    

       B0BTS1           FC
       JMP              GO_ON_DO          

       B0MOV    	A,temp0
       B0MOV    	dividend0,A  
                	
       B0MOV    	A,temp1
       B0MOV    	dividend1,A  
                 	
GO_ON_DO:
	DECMS    	temp
	JMP      	DIV4_LP
	
	bclr	fc
	rrcm	divisor1
	rrcm	divisor0
	
	mov	a,dividend0
	sub	a,divisor0
	mov	a,dividend1
	sbc	a,divisor1 

	rlcm	result0
	rlcm	result1

	RET
;************************************************

⌨️ 快捷键说明

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