Chipsea microcontroller division operation

Publisher:gamma14Latest update time:2013-04-03 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
;============================================
; 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

Previous article:8-bit resolution ADC inside Songhan MCU
Next article:Implementation of watchdog in multi-tasking system

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号