Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6713645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:24:17+00:00 2026-05-26T08:24:17+00:00

I have 47, in binary it’s 0010 1111. I need to split 47 so

  • 0

I have 47, in binary it’s 0010 1111. I need to split 47 so I get 4 in binary 0000 0100 and 7 in binary 0000 0111.

I have see this answer but I wonder, as Intel 8085 doesn’t have a div instruction I have to divide by doing consecutive subtractions, how do I get modulus as doing it so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:24:17+00:00Added an answer on May 26, 2026 at 8:24 am

    If your processor doesn’t have a divide instruction (or BCD conversion instructions, which would be another way), you’ll just have to do repeated subtraction. The pseudo-code for this would go something like:

        val = 47
    
        units = val
        tens = 0
    loop:
        if units < 10 goto done
        units = units - 10
        tens = tens + 1
        goto loop
    done:
        ;; tens = 4, units = 7.
    

    Apologies for the rather BASIC coding style there, I just tried to make it a little closer to how it would look in assembler language. Otherwise, I would have used a while loop 🙂

    Tho modulus is what’s left in the units variable once it drops below ten.

    For completeness (and possibly extra marks if this is a homework assignment, nudge nudge, wink wink), since a single octet can handle up to 255:

        val = 247
    
        units = val
        tens = 0
        hundreds = 0
    loop1:
        if units < 100 goto loop2
        units = units - 100
        hundreds = hundreds + 1
        goto loop1
    loop2:
        if units < 10 goto done
        units = units - 10
        tens = tens + 1
        goto loop2
    done:
        ;; hundreds = 2, tens = 4, units = 7.
    

    As proof this method works, you can try the following Python code:

    val = 47
    
    units = val
    tens = 0
    while units >= 10:
        units = units - 10
        tens = tens + 1
    
    print "Tens = %d, Units = %d"%(tens,units)
    

    which does indeed output:

    Tens = 4, Units = 7
    

    In terms of using those values to drive a LED device, a simple lookup table is probably easiest. Construct an array of values that you need to write to the two 8-bit memory addresses then use the digit to lookup those values for writing to the device.

    I’ll use a simplified seven-segment LED (plus decimal point) since it’s easier to understand:

        a
       ---
    f |   | b
       -g-
    e |   | c
       ---     . h
        d
    

    Let’s say in this example that you write a single byte abcdefgh to a memory-mapped location and the bits in this byte control what segments are on.

    The values for the different digits (without the decimal point) are (untested, so may need some tweaking):

       abcdefgh
    0  11111100
    1  01100000
    2  11011010
    3  11110010
    4  01100110
    5  10110110
    6  10111110
    7  11100000
    8  11111110
    9  11110110
    

    Given the value four, you would simply look up the byte at offset 4 in that table (using simple addition of the base address of the table and the value), then extract that byte from memory and use it to set the LED segments. That value 01100110 will set segments b, c, f and g, giving you:

    |   |
     ---
        |
    

    Your particular situation is a little more complicated since you have a fifteen-segment LED and have to write a word rather than a byte, but the theory is exactly the same.

    Have a table of values that you need to write for each digit and use the values calculated from my algorithm above to offset into that table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some binary data produced as base-256 bytestrings in Python (2.x). I need
I have a binary file of doubles that I need to load using C++.
I have a binary file of unknown format that I need to be able
I have a binary, the database table of relationships looks like this: +----+----------+---------+-----+ |
I have a binary tree that I need to search through. I'm not searching
I have two binary files equal in size, but not in values. I used
I have binary boolean functions as input strings and need an efficient way to
I have two binary files with different sizes. I need to compare first N
I have a binary image and need to convert all of the black pixels
I have binary basically, say it's 300 in length. How would I split (much

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.