;============================================
; filename: division operation .asm
; chip: CSU1182B
; author:Hu Qin
; date: 2013-02-21
;Full code download:
http://www.51hei.com/f/xhrfys.rar;=========== =================================
include CSU1182B.inc
;============ ================================
; program start
;============== ==============================
ORG 000h
GOTO CF01
ORG 015H
CF01:
MOVLW 0FFH;
MOVWF 0B7H; High 8 bits of dividend
MOVLW 0FFH ;
MOVWF 0B8H ; The lower 8 bits of the dividend
MOVLW 00H ;
MOVWF 0B9H ; The high bit of the remainder (data register for dividend processing)
MOVLW 00H ;
MOVWF 0BAH ; The low bit of the remainder (data register for dividend processing)
MOVLW 00H ;
MOVWF 0BBH ; The low 8 bits of the dividend
MOVLW 00H ;
MOVWF 0BCH ; 8 - bit high quotient
MOVLW 03H ; MOVWF 0BDH ; 8 -
bit low-order
divisor MOVLW 0E8H ;
MOVWF 0BEH ; 8-bit high-order divisor MOVLW
16 ,1 ; RLF 0BAH,1 ; Process dividend data with carry RLF 0B9H,1 ; BCF STATUS,C ; Clear C MOVFW 0BEH ; SUBWF 0BAH,0 ; Use the processed dividend to subtract the divisor MOVWF 0C1H ; MOVFW 0BDH ; SUBWFC 0B9H, 0 ; Use the processed dividend to subtract the divisor MOVWF 0C0H ; BTFSS STATUS,C ; Determine whether the processed dividend is larger than the divisor GOTO CF03 ; MOVFW 0C1H ; If so, save the quotient to the dividend processing data register MOVWF 0BAH ; MOVFW 0C0H ; MOVWF 0B9H ; CF03: RLF 0BCH,1; Shift the subtracted C left into the quotient register RLF 0BBH,1; DECFSZ 0BFH,1; Determine whether the operation is completed GOTO CF02; GOTO $ end ;=========== =================================
Reference address:Chipsea microcontroller division operation
; filename: division operation .asm
; chip: CSU1182B
; author:Hu Qin
; date: 2013-02-21
;Full code download:
http://www.51hei.com/f/xhrfys.rar;=========== =================================
include CSU1182B.inc
;============ ================================
; program start
;============== ==============================
ORG 000h
GOTO CF01
ORG 015H
CF01:
MOVLW 0FFH;
MOVWF 0B7H; High 8 bits of dividend
MOVLW 0FFH ;
MOVWF 0B8H ; The lower 8 bits of the dividend
MOVLW 00H ;
MOVWF 0B9H ; The high bit of the remainder (data register for dividend processing)
MOVLW 00H ;
MOVWF 0BAH ; The low bit of the remainder (data register for dividend processing)
MOVLW 00H ;
MOVWF 0BBH ; The low 8 bits of the dividend
MOVLW 00H ;
MOVWF 0BCH ; 8 - bit high quotient
MOVLW 03H ; MOVWF 0BDH ; 8 -
bit low-order
divisor MOVLW 0E8H ;
MOVWF 0BEH ; 8-bit high-order divisor MOVLW
16 ,1 ; RLF 0BAH,1 ; Process dividend data with carry RLF 0B9H,1 ; BCF STATUS,C ; Clear C MOVFW 0BEH ; SUBWF 0BAH,0 ; Use the processed dividend to subtract the divisor MOVWF 0C1H ; MOVFW 0BDH ; SUBWFC 0B9H, 0 ; Use the processed dividend to subtract the divisor MOVWF 0C0H ; BTFSS STATUS,C ; Determine whether the processed dividend is larger than the divisor GOTO CF03 ; MOVFW 0C1H ; If so, save the quotient to the dividend processing data register MOVWF 0BAH ; MOVFW 0C0H ; MOVWF 0B9H ; CF03: RLF 0BCH,1; Shift the subtracted C left into the quotient register RLF 0BBH,1; DECFSZ 0BFH,1; Determine whether the operation is completed GOTO CF02; GOTO $ end ;=========== =================================
Previous article:8-bit resolution ADC inside Songhan MCU
Next article:Implementation of watchdog in multi-tasking system
- Popular Resources
- Popular amplifiers
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
MoreDaily News
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
Guess you like
- The relationship between FPGA memories
- Show off the Sony headphones I got from EEWORLD
- Single tube amplifier
- TMS320F28335 SVPWM source program
- 【RPi PICO】CircuitPython Firmware
- Microwave Circuit Appreciation
- Microcontroller learning notes, teach you how to learn in three steps!
- msp430f5529 uart pwm adc
- WiFi NeoPixel Cube
- [Help] In the design of lithium battery power modules, why is every 1V of lithium battery voltage very valuable?