PSW EQU 03
R0 EQU 08
R1 EQU 09
R2 EQU 0AH
R3 EQU 0BH
R4 EQU 0CH
R5 EQU 0DH
R6 EQU 0EH
R7 EQU 0FH
TEMP EQU 13H
CNT1 EQU 11H
CNTH EQU 12H
BUF0 EQU 17H
BUF1 EQU 18H
ESUM1 EQU 13H
ESUM2 EQU 14H
ESUM3 EQU 15H
ESUM4 EQU 16H
DSUM1 EQU 19H
DSUM2 EQU 1AH
DSUM3 EQU 1BH
DSUM4 EQU 1CH
DSUM5 EQU 1DH
DSUM6 EQU 1EH
ORG 1FFH
GOTO RADM
ORG 000
D_ADD MOV F R0,0
ADDWF R6,1
BTFSC PSW,0
INCF R7
MOV F R1,0
ADDWF R7,1
RETLW 0
DMU1 MOV LW 16
MOV WF TEMP
CLRF R7
CLRF R6
DMUL_1 RRF R3
RRF R2
BTFSC PSW,0
CALL D_ADD
RRF R7
RRF R6
RRF R5
RRF R4
DECFSZ TEMP
GOTO DMUL_1
RETLW 0
RADM CLRF ESUM1
CLRF ESUM2
CLRF ESUM3
CLRF ESUM4
CLRF DSUM1
CLRF DSUM2
CLRF DSUM3
CLRF DSUM4
CLRF DSUM5
CLRF DSUM6
MOV LW 20H
MOV WF CNTH
RADM_1 MOV LW 00
MOV WF CNTL
RADM_2 MOV LW 64H
MOV WF R3
MOV LW 85H
MOV WF R2
MOV F BUF1,0
MOV WF R1
MOV F BUF0,0
MOV WF R0
CALL DMUL
MOV LW 19H
ADDWF R4,0
MOV WF R0
MOV WF BUF0
BTFSC PSW,0
INCF R5
MOV LW 36H
ADDWF R5,0
MOV WF R1
MOV WF BUF1
MOV F R0,0
ADDWF ESUM1,1
BUFSS PSW,0
GOTO EADD_1
INCF ESUM2
BTFSS PSW,2
GOTO EADD_1
INCF ESUM3
BTFSS PSW,2
GOTO EADD_1
INCF ESUM4
EADD_1 MOV F R1,0
ADDWF ESUM2,1
BTFSS PSW,0
GOTO EADD_2
BTFSS PSW,2
GOTO EADD_2
INCF ESUM4
EADD_2 BTFSC R1,7
GOTO RADM_3
COMF R0,1
COMF R1,1
MOV LW 1
ADDWF R0,1
BTFSC PSW,0
INCF R1
RADM_3 MOV LW 80H
ADDWF R1,1
MOV F R1,0
MOV WF R3
MOV F R0,0
MOV WF R2
CALL DMUL
MOV F R4,0
ADDWF DSUM1,1
BTFSS PSW,0
GOTO DADD_1
INCF DSUM2
BTFSS PSW,2
GOTO DADD_1
INCF DSUM3
BTFSS PSW,2
GOTO DADD_1
INCF DSUM4
BTFSS PSW,2
GOTO DADD_1
INCF DSUM6
DADD_1 MOV F R5,0
ADDWF DSUM2,1
BTFSS PSW,0
GOTO DADD_2
INCF DSUM3
BTFSS PSW,2
GOTO DADD_2
INCF DSUM4
BTFSS PSW,2
GOTO DADD_2
INCF DSUM5
BTFSS PSW,2
GOTO DADD_2
INCF DSSUM6
DADD_2 MOV F R6,0
ADDWF DSUM3,1
BTFSS PSW,0
GOTO DADD_3
INCF DSUM4
BTFSS PSW,2
GOTO DADD_3
INCF DSUM5
BTFSS PSW,2
GOTO DADD_3
INCF DSUM6
DADD_3 MOV F R7,0
ADDWF DSUM4,1
BTFSS PSW,0
GOTO DADD_4
INCF DSUM5
BTFSS PSW,2
GOTO DADD_4
INCF DSUM6
DADD_4 DECFSZ CNTL
GOTO RADM_2
DECFSZ CNTH
GOTO RADM_1
MOV LW 5
MOV WF CNTL
RADM_4 BCF PSW,0
RRF ESUM4
RRF ESUM3
RRF ESUM2
RRF ESUM1
DECFSZ CNTL
GOTO RADM_4
MOV LW 5
MOV WF CNTL
RADM_5 BCF PSW,0
RRF DSUM6
RRF DSUM5
RRF DSUM4
RRF DSUM3
RRF DSUM2
RRF DSUM1
DECFSZ CNTL
GOTO RADM_5
LOOP GOTO LOOP
END
上一篇:PIC16C54单片机控制的电话扩音器
下一篇:PIC摩托车防盗器原理图及程序
推荐阅读最新更新时间:2024-03-16 15:48