Understanding Binary Multiplication with a 7 Segment Display: A Beginner's Guide

  • Thread starter Thread starter shoukisuke
  • Start date Start date
  • Tags Tags
    Binary
AI Thread Summary
The discussion focuses on multiplying a digital input by 2 and 4 using a shift register in a circuit for a 7-segment display. Participants explain that shifting bits in a register effectively multiplies the binary number, with two shifts yielding a multiplication by 4. A key challenge arises in converting an 8-bit output from the counter to a 12-bit format required for the display. Suggestions include using a binary-coded decimal (BCD) counter to simplify the conversion process and employing multiple decoders for the 7-segment displays. The conversation highlights the importance of understanding the output format needed for accurate display representation.
shoukisuke
Messages
8
Reaction score
0
Shifting up from binary URGENT!

Hi, I have a project that requires me to multiply a digital input by 2 and 4. Every website I've looked at keeps telling me to "shift it up 2 bits". I know how that works theoretically, ie. adding a 0 after the binary number would be multiplying it by 2. But how exactly does that work with the circuit? And where do we do it? I'm using 7 segment display, btw.

- Thanks in advance.
 
Physics news on Phys.org


Hi shoukisuke-

Hopefully your project is using hexidecimal (scale of 16) and not decimal (scale of 10). The following applies only to hexidecimal.

Read http://www.electronics-tutorials.ws/sequential/seq_5.html

The shift register in the illustration "shifts" the bits in the flip flops to the right every time the registers are clocked (reads D into Q). This is is equivalent to multiplying by 2. Two shifts is equivalent to multiplying by 4.

Bob S
 


Suppose you have a number X stored in a register. The register would consist of, say, n D flip-flops. Let's label them FF0, FF1, ..., FFn-1, where FF0 corresponds to the least-significant bit of X, and FFn-1 to the most-significant bit. If you want the number 2X stored in the register, you'd set the input of FF0 to 0 and the input of FFi to the output of FFi-1. On the next clock cycle, 2X would be loaded into the register. Make sense?
 


Yes, now I get that. Hmm but do you know how to convert 8 bit to 12 bit? Right now, I seem to understand how to do the shift part. But after the multiplying, I get an 8 bit input, and I need 12 bit for the 7-seg display. Do you know how to convert this with an ic?
 
Last edited:


Thanks for the quick reply, Bob. Right now, I seem to understand how to do the shift part. But after the multiplying, it's an 8 bit input, and I need 12 bit for the 7-seg display. Do you know how to convert this with an ic?
 


I'm not sure what you're asking. Can you explain the problem in a bit more detail?
 


I am counting heartbeats. The time settings are 15s and 30s, so I need to multiply by 2 and 4 depending on the setting the user chooses. So far, I got the sensor part to work , and my counter outputs an 8 bit signal. We need to output the bpm to the 3 7-segment LEDs we have, which requires a 12 bit output. What I'm wondering is, how to convert the 8 bit signal to the 12 bit output.

-Thank you
 


Presumably, you want the output in decimal, so I see a problem. If your counter represents the number in binary, you need to somehow convert it to decimal digits so you know how to drive each digit in the display. On the other hand, you could use a decimal counter, but that complicated the multiplication. Of the two approaches, I think the latter is preferable because you can avoid the need to multiply by being clever, but then again, I don't know what types of ICs you have available.
 


What kind of IC would you need to convert the binary to decimal? We're allowed to use any kind of IC's as long as it's not programmable...
 
  • #10


shoukisuke said:
Thanks for the quick reply, Bob. Right now, I seem to understand how to do the shift part. But after the multiplying, it's an 8 bit input, and I need 12 bit for the 7-seg display. Do you know how to convert this with an ic?
Your data needs to be in binary (hexidecimal) format (NOT BCD (binary coded decimal) format).

Look at the 4-bit register in http://www.electronics-tutorials.ws/sequential/seq_5.html

The Q outputs of the individual flip flops in the shift register are attached to a 4-line to 7-segment decoder like

http://www.datasheetcatalog.org/datasheet/motorola/MC14495P1.pdf

Look at the 4-line hexadecimal to the 7-segment decoder truth table in the lower right corner of the first page.

hex display for 0 to 16 is: 0 1 2 3 4 5 6 7 8 9 A B C D E F



Bob S
 
  • #11


My point is that there's probably some IC available somewhere for taking binary input and driving a 7-segment display. If you can find one, your problem is solved, but I'd guess that that's not what your instructor intended.
 
  • #12


Is the output supposed to be in decimal or not? I'm inferring it does as you said you have a three-digit display.
 
  • #13


@bob: I have an 8 bit binary number from the counters. I shift the 8 bit binary number using an 8 bit shift register and I have an 8 bit binary number that is multiplied by two. How do I get a 12 bit number so I have a 4bit input for each decoder of the 3 x 7segment displays? I read your post and i don't understand how it converts 8bit to 12 bit. You suggest that I just shift it and then just put it into a decoder.

@vela: Yes, 12-bit decimal.
 
Last edited:
  • #14


shoukisuke said:
You suggest that I just shift it and then just put it into a decoder?
Yes. For an 8 bit register, you need two hexadecimal to 7 segment decoders side by side, each decoding 4 segments. If you have a 12 bit shift register, use 3 hex to 7 segment decoders.

Bob S
 
Last edited:
  • #15


shoukisuke said:
@vela: Yes, 12-bit decimal.
This is a critical piece of information. Bob was assuming, as he said in his first post, that you're using only hexadecimal, not decimal.

If I were you, I'd go with a BCD counter instead of a binary counter.
 
  • #16


@bob: Wouldn't using only 2 hexadecimal only output 2 displays for the 7-segment LED?
 
  • #17


shoukisuke said:
@vela: Yes, 12-bit decimal.
Just to clarify, if your heart rate is 64 beats per minute, do you want the display to read 064 or 040 (which is the representation of 64 in hexadecimal)?
 

Similar threads

Replies
14
Views
5K
Replies
9
Views
12K
Replies
2
Views
4K
Replies
6
Views
2K
Replies
10
Views
3K
Replies
1
Views
6K
Back
Top