Base conversion 89c51 programming example 1.1

Publisher:梦想学院Latest update time:2015-12-24 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Title: Convert the eight-bit binary number in accumulator A into a three-bit decimal number in BCD format

The circuit diagram only needs to use the minimum system, without any external devices. The circuit diagram is as follows:

89c51 Programming Example 1.1

The source code is as follows:

  org 00h
  sjmp start
  org 30h

start:

  mov a,#123   ; put the operand into A
  mov b,#100          ; hundreds digit
  div a,b             ; find the hundreds digit, quotient A remainder B
  mov 30h,a           ; save the hundreds digit to 30h
  mov a,b             ; send the remaining two lower digits to the dividend
  mov b,#10           ; divisor 10
  div a,b             ; find the tens digit
  mov 31h,a            ; store the tens digit in 31H
  mov 32h,b            ; store the ones digit in 32h
  sjmp $
end

Reference address:Base conversion 89c51 programming example 1.1

Previous article:BCD code multiplication 89C51 single chip microcomputer programming example
Next article:Using LED to realize the running light--Single-chip microcomputer simulation experiment

Latest Microcontroller Articles
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号